mapping of varchar primary key from database as assigned but while try to get data data
automatically deleted.
--------------------------------------------------------------------------------------------------------------
Key: HHH-3666
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3666
Project: Hibernate Core
Issue Type: Bug
Environment: hibernate 3
Database MySql
Reporter: Prashant k Patil.
I am trying to get data from database. It is successfully receives data if it is add by
hibernate.
If that data is manually added in database it is automatically deleted by hibernate.
my mapping to table like this.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD
3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Dec 17, 2008 1:38:05 PM by Hibernate Tools 3.1.0.beta5 -->
<hibernate-mapping>
<class name="com..entity.User" table="user"
dynamic-update="true" catalog="database">
<comment></comment>
<id name="userId" type="string" length="30">
<column name="USER_ID" />
</id>
<property name="password" type="string" length="30">
<column name="PASSWORD">
<comment></comment>
</column>
</property>
</class>
</hibernate-mapping>
and code using like this .
Transaction tx = null;
try {
Session currentSession = InitializeSessionFactory.getInstance().getCurrentSession();
tx = currentSession.beginTransaction();
//User temp = new User("doctor","doctor","DOCTOR",new
Integer(1));
//currentSession.save(temp);
User user = (User)currentSession.get(User.class, userId);
tx.commit();
return user;
}catch(Exception e) {
tx.rollback();
logger.error(e.getMessage());
}
please help me so that data not to be deleted.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira