-->
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.  [ 1 post ] 
Author Message
 Post subject: different access to a many-to-one
PostPosted: Mon Nov 05, 2007 12:08 pm 
Newbie

Joined: Mon Sep 10, 2007 9:30 am
Posts: 12
Hello,

I use 3.2.5.ga with dynamic models.
For a many-to-one association between the examples invoice and customer I would like to access the customer-attribute with two ways:

1. over the entire customer-entity. Like "Customer customer = invoice.get("INV_CUST");"

2. only the value of the foreign-key column (O_CUST_ID) without loading the customer-entity internal. Like "long customerId = invoice.get("INV_CUST");"

I tried this:
Code:
<class entity-name="INVOICE">
...

  <many-to-one name="INV_CUST" entity-name="CUSTOMER">
    <column name="O_CUST_ID" />
  </many-to-one>

  <property name="INV_CUST_KEY" type="long">
    <formula>O_CUST_ID</formula>
  </property>

...
</class>

but the attribute INV_CUST_KEY is read-only, so I need to have a customer-object to set the association.

Is there a way to have both possibilities with only one attribute?

regards


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.