-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate Code Generator buggy ?
PostPosted: Tue Jan 29, 2008 12:43 pm 
Newbie

Joined: Mon Jan 28, 2008 11:47 am
Posts: 2
I used "Hibernate Code Generator Dialog" to generate DAO classes with this configuration:
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 name="test">
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.password">joe</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost/mydb</property>
        <property name="hibernate.connection.username">joe</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
    </session-factory>
</hibernate-configuration>


the JNDI name should be "test", not the default "SessionFactory"
Here the generated code:


Code:
   protected SessionFactory getSessionFactory() {
      try {
         return (SessionFactory) new InitialContext()
               .lookup("SessionFactory");
      } catch (Exception e) {
         log.error("Could not locate SessionFactory in JNDI", e);
         throw new IllegalStateException(
               "Could not locate SessionFactory in JNDI");
      }
   }


"SessionFactory" is used instead of "test" for the lookup. This is a bug isn't it ? the generated code should be:

Code:
.lookup("test");



How can it be working if I don't rename the JNDI name ? If more than
one hibernate application is running in my Application Server, there
will be a conflict on "SessionFactiory" entry in JNDI ! no ?

config:
Eclipse 3.3.0
hibernate-3.2.5.ga
HibernateTools-3.2.0.GA
JDK 1.5.0.12
Windows XP


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.