]
Mandar Shukla updated ANN-768:
------------------------------
Attachment: FlightMaster.java
Getting org.hibernate.MappingException for basic Hibernate
annotations application
----------------------------------------------------------------------------------
Key: ANN-768
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-768
Project: Hibernate Annotations
Issue Type: New Feature
Affects Versions: 3.3.0.ga
Environment: Hibernate 3.3, MySql 5, Eclipse 3
Reporter: Mandar Shukla
Attachments: FlightMaster.java
Hi,
I'm trying Hibernate annotations program along with a business object having 4
attributes.
I referred one of the online tutorial and created BO class with annotations,
HibernateUtil.java, hibernate.cfg.xml, and .java with main method in it for execution.
Everything compiled successfully in eclipse but while executing I got below mentioned
exception:
Exception in thread "main" org.hibernate.MappingException: Unknown entity:
com.flylite.ticketing.model.FlightMaster
at
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:557)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1342)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:98)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
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:539)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:527)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:318)
at $Proxy9.save(Unknown Source)
at com.flylite.ticketing.application.TestFlightManager.main(TestFlightManager.java:23)
I followed all the steps as per given in tutorial apart from @Table (name="")
as we have to use appliesTo in latest version.
I doubt (I may be wrong) on @Table(appliesTo="") tag, as I tried similar
program couple of months back with lower version of Hibernate where tag was
@Table(name=""), and it ran successfully.
Please helpe me in this issue. Let me know in case I need to upload my files.
Regards
Mandar
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: