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.  [ 2 posts ] 
Author Message
 Post subject: Configuration Problems
PostPosted: Sun Jun 05, 2005 9:18 pm 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
I am using Eclipse, and have the following directory structure:

HSLDBsample
+src
++mike.dean
+++CreateTest.java
+++Track.java
+++Track.hbm.xml
++hibernate.cfg.xml

When I run the folllowing test routine, I get to the session.save(track) line but no further:

public static void main(String[] args) throws HibernateException {
SessionFactory sessions = new Configuration()
.configure()
.buildSessionFactory();
// Configuration config = new Configuration();
// config.addClass(Track.class);
// SessionFactory sessionFactory = config.buildSessionFactory();
// Session session = sessionFactory.openSession();
Session session = sessions.openSession();
Track track = new Track();
track.setTitle("Name of the track");
track.setFilePath("The filepath");
track.setPlayTime(new Date());
System.out.println("I get to here");
session.save(track);
session.close();
System.out.println("BUT NOT to here");

}

and the crash indicates:

19:15:53,705 INFO SessionFactoryImpl:366 - Checking 0 named queries
I get to here
Exception in thread "main" org.hibernate.MappingException: Unknown entity: mike.dean.Track
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:489)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1021)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:83)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:429)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:424)
at mike.dean.CreateTest.main(CreateTest.java:31)

I have tried moving the Track.hbm.xml file all over the place, but at this point I am clearly lost. Any assistance will be appreciated.

_________________
J. Michael Dean, MD


Top
 Profile  
 
 Post subject: Sorry Solved it
PostPosted: Sun Jun 05, 2005 10:00 pm 
Beginner
Beginner

Joined: Fri Mar 04, 2005 7:12 pm
Posts: 34
Needed to add the Track.hbm.xml to the hibernate.cfg.xml file as is indicated in the documentaiton. Sorry.

_________________
J. Michael Dean, MD


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