-->
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: JNDI error.. in hibernate
PostPosted: Fri Jul 06, 2007 11:26 am 
Beginner
Beginner

Joined: Thu Jan 04, 2007 5:46 am
Posts: 31
Hi
i get the follwoing error when i try connecting database from hibernate through JNDI .

Code:
java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrapperDataSource
   at com.test.hibernate.generated.InsuranceHome.getSessionFactory(InsuranceHome.java:48)
   at com.tes.thibernate.generated.InsuranceHome.<init>(InsuranceHome.java:24)
   at com.test.hibernate.generated.InsuranceDao.getdata(InsuranceDao.java:29)
   at test.FirstBeanController.retriveData(FirstBeanController.java:16)



Can any body hepl me out in this..
My hibernate cfg file
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
       
        <property name="hibernate.connection.datasource">java:/MySqlDS</property>
      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
     
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
      <property name="hibernate.cglib.use_reflection_optimizer">false</property>
       
        <property name="show_sql">true</property>
       <property name="hibernate.format_sql">true</property>
        <property name="hbm2ddl.auto">none</property>
        <property name="cache.use_second_level_cache">false</property>
      <property name="hibernate.current_session_context_class">thread</property>
      <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

   <mapping resource="com/sellermania/hibernate/generated/insurance.hbm.xml"/>
   
    </session-factory>
</hibernate-configuration>


Top
 Profile  
 
 Post subject: Difference between JNDI and bildsessionfactory in hibernate
PostPosted: Sat Jul 07, 2007 4:48 am 
Beginner
Beginner

Joined: Thu Jan 04, 2007 5:46 am
Posts: 31
Hi
which is the best way of getting Sessionfactory in hibernate.
1.sessionFactory = new Configuration().configure ().buildSessionFactory();
or
2.By using JNDI lookup.

what is the difference between these two ways..

can any explain in detail


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.