Hi all,
Can anyone tell me why hibernate seems to change id's of records retrieved from database ?
When I type the following query:
select f.forum_id as forum_id0_, f.name as name0_ from Forum as f
i have two records both of which are returned, but id numbers 1 and 2 are both changed into 0. Why ?
When I type the following query - however -
select f.forum_id as forum_id0_, f.name as name0_ from Forum as f where f.forum_id=2
Here the stack trace shows that hibernate changed the identifier from
2 to 0.
Any light shed on the matter will be appreciated.
regards,
sanjeev.
Code:
[java] net.sf.hibernate.HibernateException: identifier of an instance of Fo
rum altered from 1 to 0
[java] at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:25
24)
[java] at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.jav
a:2347)
[java] at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.j
ava:2340)
[java] at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl
.java:2207)
[java] at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2186
)
[java] at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTrans
action.java:61)
[java] Foo cast done !!!
[java] My foo id is:0
[java] My foo id is:0
[java] HibernateException stack trace followsidentifier of an instance of F
orum altered from 1 to 0
[java] at QueryEngine.runprog(QueryEngine.java:180)
[java] at QueryEngine.<init>(QueryEngine.java:38)
[java] at Myfe.actionPerformed(Myfe.java:111)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton
.java:1786)
[java] at javax.swing.AbstractButton$ForwardActionEvents.actionPerforme
d(AbstractButton.java:1839)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultBut
tonModel.java:420)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.
java:258)
[java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Basi
cButtonListener.java:245)
[java] at java.awt.Component.processMouseEvent(Component.java:5099)
[java] at java.awt.Component.processEvent(Component.java:4896)
[java] at java.awt.Container.processEvent(Container.java:1569)
[java] at java.awt.Component.dispatchEventImpl(Component.java:3614)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1627)
[java] at java.awt.Component.dispatchEvent(Component.java:3476)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.j
ava:3483)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.ja
va:3198)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3
128)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1613)
[java] at java.awt.Window.dispatchEventImpl(Window.java:1606)
[java] at java.awt.Component.dispatchEvent(Component.java:3476)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
[java] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDi
spatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDisp
atchThread.java:151)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:145)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:137)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:100
)