-->
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.  [ 7 posts ] 
Author Message
 Post subject: Does this viewpoint of mine is total wrong!!
PostPosted: Sun Mar 14, 2004 10:47 am 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
entity A or B,A:B=1:N(one2many)

every runs ok,but when i change the primary key of entity B,the jbuilder9t tell me the error:net.sf.hibernate.HibernateException: identifier of an instance of com.one2many.Publication altered from publication NO1111 to NO2222

at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2524)

at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2347)

at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2340)

at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2207)

at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186)

at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)

at com.one2many.hibernateupdate.main(hibernateupdate.java:73)

i just want when i change the primary key of b,the primary key of a is also changed by the code i write in the jbuilder9!!


Does my option change the primary key of some entity is total wrong!!!!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2004 1:23 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Primary key must not have more meaning than identity and you never need to change it.


Top
 Profile  
 
 Post subject: but some viewpoint at hibernate,i just strongly disagree....
PostPosted: Sun Mar 14, 2004 8:13 pm 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
the docment of hiernate always say : the primary key of the entity must not have any operation meaning,but at my viewpoint,i want integrat many,many operation meaning to the primary key.

why i like do this is because the primary key that have operation meaning is very facility!!! at the past project,i always like use the primary key that contains a lot of operation meaning.

I DO NOT understand why the hibernate advocate the meaningless primary key??
I DO NOT understand!!!


Top
 Profile  
 
 Post subject: more.....
PostPosted: Sun Mar 14, 2004 8:15 pm 
Regular
Regular

Joined: Tue Dec 30, 2003 2:35 am
Posts: 85
never need to change it???
Does this viewpoint is the very strict rule to the programmer?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 1:56 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It is not for hibernate, primiry key must meaningless for any database in theory, meaning can change if key has more meaning than identity, so you can loose the main meaning, identity.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 3:48 am 
Newbie

Joined: Wed Mar 03, 2004 10:19 am
Posts: 11
Location: Netherlands
See http://opensource.atlassian.com/project ... key=HB-817 for a (partial) solution for updatable primary keys


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 4:30 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Primary key update is a poor DB schema design symptom, ask DBA before to do it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.