Hi,
I am using hibernate and spring mvc, when i insert a record in DB, and try to access that that right after that, then i don't get the result. e.g. if insert a record for newly reg. user and login in him right after registering it then result set is empty. I am using hibernate templates.
what could be the problem and what i am missing...
thx.
my [app].servlet.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/dbb" />
<property name="username" value="r123" />
<property name="password" value="1234" />
</bean>
<bean id="hbSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="mappingResources">
<list>
<value>UserAttributes.hbm.xml</value>
<value>BlessUser.hbm.xml</value>
<value>SnsType.hbm.xml</value>
<value>SnsUser.hbm.xml</value>
<value>SnsAuthenticator.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
<prop key="hibernate.transaction.flush_before_completion">false</prop>
<prop key="hibernate.transaction.auto_close_session">false</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
DAO method
public void saveOrUpdate(E transientObject) {
getHibernateTemplate().saveOrUpdate(transientObject);
}
HBM
<id name="Id" type="java.lang.Integer" column="bless_uid">
<generator class="native" />
</id>
<property column="name" length="255" name="Name" not-null="false" type="java.lang.String" />
<property column="email" length="255" name="Email" not-null="false" type="java.lang.String" />
<property column="user_name" length="255" name="UserName" not-null="false" type="java.lang.String" />
<property column="password" length="255" name="Password" not-null="false" type="java.lang.String" />
<set name="snsUser" lazy="false" cascade="all" table="sns_User">
<key column="bless_uid" />
<one-to-many class="com.utilami.model.SnsUser" />
</set>