-->
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: IS IT POSSIBLE (Please help)
PostPosted: Tue Mar 09, 2004 12:09 am 
Newbie

Joined: Thu Mar 04, 2004 5:41 am
Posts: 10
I am newbie to Hibernate trying to find a weird solution. I am not sure I am right or is it possible in hibernate

Here is the scenario
Dept
Dept_ID
DeptName
Description
DeptAlias
DeptLocation


Employee
Employee_id
EmpName
Dept_ID
....


I successfully implemented the relation where I can get the Dept object for each employee.

My reqt is to get only the deptname for each employee, Not the entire Dept object ..


Is is possible that I can able to retrieve the dept selected columns in Employee object.

Employee.
------
Employee_id
empName
deptname
deptlocation


Please let me know if it possible.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 12:46 am 
Beginner
Beginner

Joined: Tue Jan 27, 2004 2:14 pm
Posts: 40
Location: Atlanta, GA, USA
Code:
select e.department.deptName from Employee as e where e.id = ?

This would get you the employee's department name based on the employee id.

Hope this helped! ;)


Top
 Profile  
 
 Post subject: IS IT POSSIBLE
PostPosted: Tue Mar 09, 2004 2:32 am 
Newbie

Joined: Thu Mar 04, 2004 5:41 am
Posts: 10
Thanks

But I am looking data as a part of object without tweaking it.

Please let me know if you know any work arounds.

Is any one know or used property-ref can I able to use in this scenario

thanks for help


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2004 3:16 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
If you are worried about performance, Hibernate will only get (query) a Department object when it needs to, ie. only for Departments it has not seen before during the current Hibernate session. If the Department has been resolved by a prior Employee access, then the Department will come out of cache, instead of hitting the DB again.


Sherman


Top
 Profile  
 
 Post subject: IS IT POSSIBLE
PostPosted: Tue Mar 09, 2004 9:24 am 
Newbie

Joined: Thu Mar 04, 2004 5:41 am
Posts: 10
hmm...

I know about that

My reqt is to get a column from the parent object so I do not have to execute any chunk of code. It applies to all my objects. Trying to find a way to access data in each child object so I do not have to include parent object into the child VO object.

Let me know if some property can be used to get parent data, Some one suggested me formula property Still hunting around..

thanks


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.