-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: tiro hibernate of error! I make not well ! please help me
PostPosted: Wed Dec 13, 2006 12:01 am 
Newbie

Joined: Tue Dec 12, 2006 11:50 pm
Posts: 10
LogicDAO dao = new LogicDAO();
Logic logic=new Logic();
try {
Session s=dao.getSession();
Transaction t=s.beginTransaction();
t.begin();
logic.setUsername("aa");
logic.setPwd("aa");
dao.save(logic);
t.commit();

} catch (HibernateException e) {
System.err.println("Entity retrieval failed.");
e.printStackTrace();
} finally {
try {
dao.getSession().close();
} catch (Exception e) {
e.printStackTrace();
}
}

Error is:

Entity retrieval failed.
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.hibernate.db.Logic
at org.hibernate.id.Assigned.generate(Assigned.java:33)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
at com.hibernate.db.LogicDAO.save(LogicDAO.java:27)
at com.hibernate.db.A.main(A.java:22)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 13, 2006 12:06 am 
Newbie

Joined: Thu Aug 10, 2006 12:25 am
Posts: 13
You will need to provide more information, but the first line seems to give the pointer

ids for this class must be manually assigned before calling save()


how have you set up the identity


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.