-->
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: Property type='customtype' equivalent in many-to-one
PostPosted: Mon Nov 22, 2010 1:29 pm 
Newbie

Joined: Mon Nov 22, 2010 1:12 pm
Posts: 1
I have a database with a field value that is not a foreign key into another table directly, but whose value can be computed into such a key. Initially, I loaded a field "project" from a batch jobs table as:

<property name="project"
column="CMD"
type="BSApp.BSProject"
insert="false"
update="false"
unique="false"
/>

where "project" was computed from the command given to a batch queue "jobs" table. The batch system has no notion of PROJECT, but my app can determine it from the command string value.

Now, I have a "PROJECTS" class and am trying to establish a many-to-one relationship between projects and jobs; that is, each job refers to at most one project, but a project can be associated with many jobs. However, the project is 'computed' from the CMD. That is, I am trying to do "effectively"

<many-to-one name="project"
column="CMD"
entity-name="project"
type="BSApp.BSProject"/>

(with the reverse relationship

<set name="jobs"
inverse="true">
<key column="CMD"/>
<one-to-many entity-name="job"
type="BSApp.BSProject"/>
</set>
in my PROJECTS table).

But MANY-TO-ONE and ONE-TO-MANY do not accept the "type" attribute.

Is there a way for many-to-one and one-to-many to map through a custom datatype method similar to the one used by "property"?

Thank you,
JKE


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.