hibernate问题

我的中国梦 发布于 2013/11/16 20:06
阅读 286
收藏 0
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Hibernate: select max(id) from Street
Hibernate: select max(id) from District
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.accp.ay213.model.District
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:430)
at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265)
at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:619)
at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3141)
at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:501)
at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:227)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:150)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at org.acccp.ay213.Test.HibernateTest.SaveInfo(HibernateTest.java:38)
at org.acccp.ay213.Test.HibernateTest.main(HibernateTest.java:11)


加载中
0
pantrick
pantrick

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.accp.ay213.model.District 

这个对象没保存

有可能的话,设置成级联保存!

0
我的中国梦
我的中国梦
恩,谢谢了!我解决了。
返回顶部
顶部