-->
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: Bug or intention ?
PostPosted: Thu Jan 05, 2006 4:29 am 
Beginner
Beginner

Joined: Thu Jun 10, 2004 6:52 am
Posts: 29
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.1

Mapping documents:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<hibernate-mapping>
<class name="pack.I18nTest"
table="i18ntest">

<id name="id" column="id" type="java.lang.Long">
<generator class="native"/>
</id>

<property name="description" type="I18nlabel"
column="description" />
</class>
</hibernate-mapping>



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

Full stack trace of any exception that occurs:

Name and version of the database you are using: MySQL 4.1

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

From my tests, it seems that if I do not specify the property name for id in the hbm file above, meaning if I delete the 'name="id"' from the mapping, the id will not be populated with the autogenerated value from the database (the entity is saved, everything else works as expected). I don't know if this is how it is intended to be, or is a bug, that's why I posted it here, maybe somebody can check and if it's a bug than someone can fill a bug with it (I don't think I have the right to fill in issues in jira)

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 4:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its a documented (not recommended) feature which allows you to persist objects with no actual id property and let the hibernate session manage the id internally.

_________________
Max
Don't forget to rate


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.