-->
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: Wired mapping exception
PostPosted: Fri Aug 13, 2004 3:28 pm 
Newbie

Joined: Mon Jun 21, 2004 3:43 pm
Posts: 19
Hibernate version:
version 2.1.4

Mapping documents:
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>
<!--
    Created by the Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="test.User"
    table="users"
>

    <id
        name="uno"
        type="java.lang.Integer"
        column="Uno"
    >
        <generator class="identity" />
    </id>

    <property
        name="uname"
        type="java.lang.String"
        column="UName"
        not-null="true"
        length="25"
    />

    <!-- associations -->
    <!-- bi-directional one-to-many association to Model -->
    <set
        name="models"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="Uno" />
        </key>
        <one-to-many
            class="test.Model"
        />
    </set>

</class>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Cannot step into this part yet

Full stack trace of any exception that occurs:

When debug , step into Hibernate Mapping exception after configure!

Name and version of the database you are using:

MySQL 4.18

Debug level Hibernate log excerpt:

no error message!


Top
 Profile  
 
 Post subject: More explaination about the problem
PostPosted: Fri Aug 13, 2004 5:45 pm 
Newbie

Joined: Mon Jun 21, 2004 3:43 pm
Posts: 19
I don't have any error message, but when I run the code below

Code:
  Configuration cfg = new Configuration().addClass(User.class)
                                                           .addClass(Model.class);
  SessionFactory sessions = cfg.buildSessionFactory();

// Cannot go to the next step, instead go to the exception.

  Session session = sessions.openSession();



Seems like I cannot build the sessionFactory.

Actually, I use MiddleGen to generate the *.hbm.xml and then use HBM2JAVA tools to generate the java codes-- User.java and Model.java

Do I need to modify anything for those java files or xml?

my database is MySQL 4.18, and the Table primary key is auto_increment.
So I modify the hbm.xml file from " <generator class="identity" />" To "<generator class="identity" />"

Anybody has any idea what wrong I have?

Thanks a millions.


Top
 Profile  
 
 Post subject: Log file
PostPosted: Fri Aug 13, 2004 7:08 pm 
Newbie

Joined: Mon Jun 21, 2004 3:43 pm
Posts: 19
the hibernate log is shown below

//Start access Database//
14:35:02,812 INFO Environment:462 - Hibernate 2.1.4
14:35:02,812 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.gjt.mm.mysql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.query.imports=net.sf.hibernate.test, net.sf.hibernate.eg, hibernate.connection.username=test, hibernate.connection.url=jdbc:mysql://localhost/test?useUnicode=true&characterEncoding=GBK, hibernate.show_sql=true, hibernate.connection.password=test, hibernate.statement_cache.size=0, hibernate.connection.pool_size=0}
14:35:02,828 INFO Environment:521 - using java.io streams to persist binary types
14:35:02,828 INFO Environment:522 - using CGLIB reflection optimizer
14:35:02,843 INFO Configuration:347 - Mapping resource: test/User.hbm.xml
14:35:03,437 INFO Binder:229 - Mapping class: test.User -> users
14:35:03,546 INFO Configuration:347 - Mapping resource: test/Model.hbm.xml
14:35:03,593 INFO Binder:229 - Mapping class: test.Model -> model
14:35:03,593 INFO Configuration:613 - processing one-to-many association mappings
14:35:03,593 INFO Binder:1168 - Mapping collection: test.User.models -> mod

And then went to exception.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 14, 2004 6:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Give full exception with stacktrace.


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.