aspose file tools*
The moose likes Object Relational Mapping and the fly likes getting exception while running a OnetoMany mapping between Person and Phone classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "getting exception while running a OnetoMany mapping between Person and Phone classes" Watch "getting exception while running a OnetoMany mapping between Person and Phone classes" New topic
Author

getting exception while running a OnetoMany mapping between Person and Phone classes

Janki Shah
Ranch Hand

Joined: Nov 23, 2011
Posts: 136
Exception in thread "main" org.hibernate.MappingException: Unknown entity: java.util.HashSet
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:693)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1485)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:120)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:713)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:701)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:697)
at com.code.test.Test.main(Test.java:31)

Can some one please help me with this error?
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

Hard to say without seeing your mappings but my guess is you are trying to persist a HashSet of objects that are not entities. You should look at ElementCollections for persisting collections of basic types.


[How To Ask Questions][Read before you PM me]
 
Don't get me started about those stupid light bulbs.
 
subject: getting exception while running a OnetoMany mapping between Person and Phone classes