-->
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.  [ 7 posts ] 
Author Message
 Post subject: Must not generate a source for component
PostPosted: Tue Jan 29, 2008 12:26 pm 
Newbie

Joined: Mon May 14, 2007 3:11 am
Posts: 4
Hello.

We generating our source java files with <hbm2java/> from a set of source hbm files.

I want to use component feature of the mapping file and have a problems with the folloing mapping file:
Code:
<hibernate-mapping package="ru.invito.model">
    <class name="BookingOrder" table="booking_order">
      <meta attribute="implements" inherit="false">ru.invito.model.BusinessObject</meta>
      <id name="code" column="CODE" type="java.lang.Long">
        <meta attribute="use-in-equals">true</meta>
        <generator class="sequence">
          <param name="sequence">booking_order_seq</param>
        </generator>
      </id>
       .. some properties and many-to-one relations..
      <component name="transferService" class="ru.invito.model.support.FlaggedBookingServices">
        <property name="flagValue" column="TRANSFER_FLAG" />
        <property name="price" column="TRANSFER_PRICE" />
        <property name="providerId" column="TRANSFER_FLAG_PROVIDER_ID" />
      </component>
    </class>
</hibernate-mapping


When the compiled class ru.invito.model.support.FlaggedBookingServices not present on the classpath i receive a:

Code:
java.lang.ClassNotFoundException: ru.invito.model.support.FlaggedBookingServices


But, when a compile it before running <hbm2java/> task, the tool successfully finishes it's work (with warning: Component ru.invito.model.support.FlaggedBookingServices found more than once! Will only generate the last found.) AND my source java file FlaggedBookingServices is overwritten with hbm2java exporter.

Is this a feature? How to instruct the tool not to (re)generate a component file, but use existing as a reference in generated entity?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 7:09 am 
Newbie

Joined: Mon May 14, 2007 3:11 am
Posts: 4
Has anybody ever faced such problem?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 8:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you did not specify any types for the properties hence we can't resolve them without looking at the component.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 02, 2008 7:27 am 
Newbie

Joined: Mon May 14, 2007 3:11 am
Posts: 4
I want to create java source file for the component (say AddressComponent.java) by hand (e.g. don't want getting generated by hbm2java tool). Then in the SomeEntity.hbm.xml i want
to reference it as SomeEntity's child component.

The SomeEntity.java would be generated by hbm2java and compoiled AddressComponent will be on the classpath for hbm2java tool.


How to achive this?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 02, 2008 7:32 am 
Newbie

Joined: Mon May 14, 2007 3:11 am
Posts: 4
max wrote:
you did not specify any types for the properties hence we can't resolve them without looking at the component.


But the compiled ru.invito.model.support.FlaggedBookingServices is avail in the classpath for the hbm2java tool.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 3:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
exgorth wrote:
max wrote:
you did not specify any types for the properties hence we can't resolve them without looking at the component.


But the compiled ru.invito.model.support.FlaggedBookingServices is avail in the classpath for the hbm2java tool.


Well, apparently it isn't ;)

How do you put it in the classpath?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 04, 2008 3:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
exgorth wrote:
I want to create java source file for the component (say AddressComponent.java) by hand (e.g. don't want getting generated by hbm2java tool). Then in the SomeEntity.hbm.xml i want
to reference it as SomeEntity's child component.

The SomeEntity.java would be generated by hbm2java and compoiled AddressComponent will be on the classpath for hbm2java tool.


How to achive this?


we don't have a "don't generate this class" option (maybe we should)

One way you can do it though is by using foreach="entity" which will only generate code for entities and not components.

_________________
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.  [ 7 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.