-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using the DAO generated in the Hiberante code generator tool
PostPosted: Fri Jun 13, 2008 12:52 pm 
Newbie

Joined: Fri Jun 13, 2008 11:36 am
Posts: 13
Hi, I'm new to Hibernate (and truth be told a Java novice as well). I'm trying to use Hibernate to connect to an existing database. I'm having trouble with DAO (tablenameHome.java files) that were generated automatically with the Hibernate Code generator in the Eclipse plugin from jboss.

Specifically, I don't seem to be able to create a session and get the tablenameHome.java to be able to see it.

Are there any examples online that specifically relate to using these objects?

Thanks in advance.

DEBUG JDBCTransaction:59 - current autocommit status: falsein10:17:56,632 DEBUG JDBCContext:214 - after transaction beginin10:17:56,648 ERROR AccrualHome:29 - Could not locate SessionFactory in JNDIinjavax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at schema.AccrualHome.getSessionFactory(AccrualHome.java:27)
at schema.AccrualHome.<init>(AccrualHome.java:22)
at de.lal.example.TestClient.createAccrual(TestClient.java:111)
at de.lal.example.TestClient.main(TestClient.java:62)
Exception in thread "main" java.lang.IllegalStateException: Could not locate SessionFactory in JNDI
at schema.AccrualHome.getSessionFactory(AccrualHome.java:30)
at schema.AccrualHome.<init>(AccrualHome.java:22)
at de.lal.example.TestClient.createAccrual(TestClient.java:111)
at de.lal.example.TestClient.main(TestClient.java:62)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 8:38 am 
Regular
Regular

Joined: Sun Apr 13, 2008 3:04 am
Posts: 71
Location: Bangalore
You JNDI configuration is wrong.

You need to configure the JNDI context with proper db location etc.. the configuration of jndi is specific to each server.. check the server doc for specifics of this configuration.

Regards,
Nagendra

_________________
Raja Nagendra Kumar,
C.T.O
http://www.tejasoft.com
TejaSoft - Specialists in Code Audit, Unit Testing and Merciless Re-factoring - Engineering Crisis Turnaround Experts


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 23, 2008 4:26 pm 
Newbie

Joined: Fri Jun 13, 2008 11:36 am
Posts: 13
You are correct. Thank you.


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