-->
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: How to populate a nested element with a custom sql-query.
PostPosted: Thu May 27, 2010 11:03 am 
Newbie

Joined: Wed May 19, 2010 4:42 am
Posts: 3
Hello, i have an interesting challenge:

I have a "simple entity" with a set or properties and I have declared a custom "sql-query" to return a value ie. "User Id "

Now the interesting part, I want to be able to populate a composite entity using the value returned by the custom "sql-query" within my "simple entity".

In other words I would like to execute the custom query to “populate a composite entity” within my "simple entity"


Last edited by 9jblanco on Thu Jun 10, 2010 5:44 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: How to populate a nested element with a custom sql-query.
PostPosted: Thu Jun 10, 2010 5:36 am 
Newbie

Joined: Wed May 19, 2010 4:42 am
Posts: 3
i am able to populate the custom entity with a custom query

Code:
<class ....
<property ...
....
<!-- custom sql for the custom entity  -->
<many-to-one name ="User" formula ="(SELECT TOP 1 UserId
                                                  FROM   dbo.UserA INNER JOIN dbo.UserB ON dbo.UserA.id = dbo.UserB.id
                                                  WHERE (dbo.UserA.sex = 'Male'))" access="field.camelcase-underscore" />

....


This gets me going , but it is not the best way of doing it .


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