-->
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: "generated-class" Metatag with Composite ID Omits
PostPosted: Mon Jul 16, 2007 8:34 pm 
Newbie

Joined: Mon Jul 16, 2007 8:15 pm
Posts: 1
I'm trying to use the generate-class metatag to generate base classes for persistence, as per:
http://www.onjava.com/pub/a/onjava/2005/12/14/hibernate-class-generation-with-hbm2java.html?page=last

I am using Hibernate 3.1.3CIP with Hibernate Tools 3.1. What I notice is that for any class that contains a composite-id, I don't see generated properties other than those contained in the composite-id itself. For example, this:

Code:
<?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 mutable="true" name="Test" table="test">
      <meta attribute="generated-class">TestBase</meta>
      <composite-id name="id" class="com.bgi.ips.identifier.composite.TestId">
         <meta attribute="use-in-equals">true</meta>
         <key-property name="issueId" column="issue_id" type="integer" />
         <key-property name="issueCodeType" column="issue_cd_type" type="string" />
      </composite-id>
      <property name="code" type="string">
         <column name="issue_cd" />
      </property>
   </class>
</hibernate-mapping>


produces this:

public class TestBase implements java.io.Serializable {

Code:
    // Fields   

     private Integer issueId;
     private String issueCodeType;

     // Constructors

    /** default constructor */
    public TestBase() {
    }
...


(Notice the missing "code" property.)

This problem seems to be universal for me. As soon as I replace the <composite-id> with a normal <id> tag, it generates all the properties. I have no idea why this would be the case. Is this a bug, or am I doing something wrong?

David


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 23, 2007 6:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
<meta attribute="generated-class">TestBase</meta>

should be

<meta inherit="false" attribute="generated-class">TestBase</meta> otherwise it overwrites the values for the subclasses.

_________________
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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.