-->
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.  [ 5 posts ] 
Author Message
 Post subject: meta - implements affects composite id
PostPosted: Sun Mar 07, 2004 5:42 pm 
Beginner
Beginner

Joined: Wed Feb 04, 2004 5:21 pm
Posts: 37
I am not sure if it is a bug or if I am using the meta tag in the wrong way.

When I try to make my PricePlan class inherit from an interface the composite class inherits as well. How can I get around this ?

Code:
<class name="PricePlan" table="price_plan" dynamic-update="false" dynamic-insert="false">
   <meta attribute="implements">CreatedDate</meta>

        <composite-id name="compid" class="ProjectIdAndTagIdKey">
            <key-many-to-one name="project" column="projectid" class="com.bluprinted.blagmodel.Project"/>
            <key-many-to-one name="tag" column="tagid" class="com.bluprinted.blagmodel.PriceTag"/>
            <key-property name="fromTime" column="from_time" type="java.util.Date">
               <column name="from_time" sql-type="datetime"/>
         </key-property>
        </composite-id>



Code:
/** @author Hibernate CodeGenerator */
public class ProjectIdAndTagIdKey implements Serializable,CreatedDate {


Cheers,

Henrik


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 08, 2004 3:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
first: read the docs about <meta>...

second: try to search the forum
third: try to look for inherit="false"

....and tell me in what step you discover the solution ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 2:17 pm 
Beginner
Beginner

Joined: Wed Feb 04, 2004 5:21 pm
Posts: 37
first :

Road map mentions that in the future support for extending a certain interface/class will be supported through a meta tag "base-class". I assume it is cut from an old forum post and refers to the current implementation. In the wiki Codegeneration with Root persistent class describes using <meta attribute="extends">.

In the reference section 19.2.2 under Toolset Guide <meta attribute="implements"> describes the approach I used. It explains that if I put a meta tag in the top of a hbm.xml file all classes will inherit the feature.

It doesn't refer to how composite-id's are treated in relation to this inheritance, but I assume that;
1) inheritance is the rule for all xml tags regardless of type
or
2) the feature is improperly implemented, as the rule is only intended to apply to <class> tags


second:

searched forum for meta implements/extends, no luck, although I saw sample code for attribute="interface" with the inherit attribute, which does hint at the solution ;)

third:

without your reply I wouldnt really have figured it out until now. Found an explanation from novemenber.

Thank you,

Henrik

P.S. I haven't found any way of disabling the generation of composite-id classes. Is it possible ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 2:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hvendelbo wrote:
first :

Road map mentions that in the future support for extending a certain interface/class will be supported through a meta tag "base-class". I assume it is cut from an old forum post and refers to the current implementation.


yes - and if you notice the text "(Now supported via <meta>)" it states that it is now available...;)

Quote:
In the wiki Codegeneration with Root persistent class describes using <meta attribute="extends">.


yes - it explains the usage of the "extends" meta attribute.

Quote:
In the reference section 19.2.2 under Toolset Guide <meta attribute="implements"> describes the approach I used. It explains that if I put a meta tag in the top of a hbm.xml file all classes will inherit the feature.


Did you read it ? ;)

It states just below the meta tag table:

"Attributes declared via the <meta> tag are per default "inherited" inside an hbm.xml file." and a few lines later it states: "Note: This applies to all <meta>-tags." and just a few words later it explains how it is used: "To avoid having a <meta>-tag inherited then you can simply specify inherit="false" for the attribute, e.g. <meta attribute="scope-class" inherit="false">public abstract</meta> will restrict the "class-scope" to the current class, not the subclasses."

Quote:
It doesn't refer to how composite-id's are treated in relation to this inheritance, but I assume that;
1) inheritance is the rule for all xml tags regardless of type
or
2) the feature is improperly implemented, as the rule is only intended to apply to <class> tags


it states it goes for *all* meta attributes and it works on all xml tags ;)

Excuse me for being very precise - but i hope this posting will be found the next time people ask this question ;)

Quote:
P.S. I haven't found any way of disabling the generation of composite-id classes. Is it possible ?


No, there ain't a "do-not-generate" meta attribute...jira entry and/or patches are welcome ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 11, 2004 2:17 pm 
Beginner
Beginner

Joined: Wed Feb 04, 2004 5:21 pm
Posts: 37
duh, my bad. Thank you for the help.

I edited the wiki page to reflect the no supported shortcomings in a separate list.

Henrik


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