-->
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.  [ 4 posts ] 
Author Message
 Post subject: Help!! Strange Problem with Config
PostPosted: Wed Oct 15, 2003 12:37 am 
Newbie

Joined: Sat Oct 11, 2003 1:47 pm
Posts: 17
Im trying to setup a simple Hibernate example and this is my Department.hbm.xml

Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="com.yoyo.hibernateimpl.objects.DepartmentHibernate" table="T_DEPARTMENT">
        <id name="departmentID" column="departmentid" type="int" unsaved-value="null">
            <generator class="assigned"/>
        </id>

        <property name="departmentName" type="java.lang.String" column="departmentname"/>

        <set name="projects">
              <key column="departmentid"/>
              <one-to-many class="com.yoyo.hibernateimpl.objects.ProjectHibernate"/>
        </set>
    </class>

</hibernate-mapping>


And i create my sessionFactory as
Code:
        Configuration config = new Configuration()
                                .addClass(com.yoyo.hibernateimpl.objects.CounterHibernate.class)
                                .addClass(com.yoyo.hibernateimpl.objects.ProjectHibernate.class)
                                .addClass(com.yoyo.hibernateimpl.objects.DepartmentHibernate.class);

        log.info("Before buildsessionfactory");
        sessionFactory = config.buildSessionFactory();


When i run this code, i can find the mapping information in the logs till

2003-10-15 00:27:32,657 DEBUG [net.sf.hibernate.cfg.Binder] Mapped property: departmentID -> departmentid, type: integer
2003-10-15 00:27:32,657 DEBUG [net.sf.hibernate.cfg.Binder] Mapped property: departmentName -> departmentname, type: string

and after this, it stops. I dont get the ""processing one-to-many association mappings" which is the first line of the buildSessionFactory() method. I dont get my log information printed either.
No Exceptions on my log .

Im totally confused. If i comment out the <set> tag , i get all the log messages for the Hibernate ones and the ones that i have in my code.

What am i doing wrong? Thanks so much.

-Raj

Code:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 12:40 am 
Newbie

Joined: Sat Oct 11, 2003 1:47 pm
Posts: 17
Im using Hibernate 2.0.3


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 4:25 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You propably forget the odmg.jar file and just don't see the classnotfound exception?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 8:08 am 
Newbie

Joined: Sat Oct 11, 2003 1:47 pm
Posts: 17
Thanks so much, Christian, That worked.
I dont see the Classnotfound if i dont have it in my classpath.
Basically what im doing is running some Cactus tests on a Jboss environment using Hibernate. When i dont have the odmg.jar, the code enters my test*** method where i get the Hibernate object, continues till the Configuration.addClass() and then goes directly to my tearDown method after a second.

Only after i added my odmg.jar, did it go through the whole sequece of running it.
I am sending the relevant portions from my log file. Let me know if it can be filed as a bug report.

Thanks
Raj

The "Before Factory" message in the log is from my JUnit Test.

Code:
2003-10-15 08:04:56,174 INFO  [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/osi_binaries/jboss-3.0.8/server/myproject/deploy/yoyo.ear
2003-10-15 08:04:56,174 INFO  [org.jboss.deployment.scanner.URLDeploymentScanner] Started
2003-10-15 08:04:56,174 INFO  [org.jboss.deployment.MainDeployer] Deployed package: file:/C:/osi_binaries/jboss-3.0.8/server/myproject/conf/jboss-service.xml
2003-10-15 08:04:56,174 INFO  [org.jboss.system.server.Server] JBoss (MX MicroKernel) [3.0.8 (CVSTag=JBoss_3_0_8 Date=200306050849)] Started in 0m:6s:629ms
2003-10-15 08:04:58,237 INFO  [STDOUT] Before Factory
2003-10-15 08:04:58,267 INFO  [net.sf.hibernate.cfg.Environment] Hibernate 2.0.3
2003-10-15 08:04:58,287 INFO  [net.sf.hibernate.cfg.Environment] loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.jdbc.batch_size=0, hibernate.connection.datasource=java:/MySqlDS, jta.UserTransaction=UserTransaction, hibernate.show_sql=true, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory}
2003-10-15 08:04:58,287 INFO  [net.sf.hibernate.cfg.Environment] using CGLIB reflection optimizer
2003-10-15 08:04:58,287 INFO  [net.sf.hibernate.cfg.Environment] JVM proxy support: true
2003-10-15 08:04:58,287 INFO  [net.sf.hibernate.cfg.Configuration] Mapping resource: com/yoyo/hibernateimpl/objects/CounterHibernate.hbm.xml
2003-10-15 08:04:58,398 INFO  [net.sf.hibernate.cfg.Binder] Mapping class: com.yoyo.hibernateimpl.objects.CounterHibernate -> T_COUNTER
2003-10-15 08:04:58,478 INFO  [net.sf.hibernate.cfg.Configuration] Mapping resource: com/yoyo/hibernateimpl/objects/ProjectHibernate.hbm.xml
2003-10-15 08:04:58,498 INFO  [net.sf.hibernate.cfg.Binder] Mapping class: com.yoyo.hibernateimpl.objects.ProjectHibernate -> T_PROJECT
2003-10-15 08:04:58,508 INFO  [net.sf.hibernate.cfg.Configuration] Mapping resource: com/yoyo/hibernateimpl/objects/DepartmentHibernate.hbm.xml
2003-10-15 08:04:58,518 INFO  [net.sf.hibernate.cfg.Binder] Mapping class: com.yoyo.hibernateimpl.objects.DepartmentHibernate -> T_DEPARTMENT
2003-10-15 08:04:59,119 INFO  [org.jboss.system.server.Server] Shutting down
2003-10-15 08:04:59,119 INFO  [org.jboss.system.server.Server] Shutting down the JVM now!


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