• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate query

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I�m having a problem makin an HQL. I need to instantiate a Value Object getting the value from another. I have VO1 and VO2. VO1 has a var Long VO2, wich is its Id. So I make a constructor on VO1:
public VO1(Long id, String vo2Name){
setId(id);
setVo2Name(vo2Name);
}
I want to get the name from VO2 and Id from VO1. So I tried:
select new VO1(v1.id,v2.name) from VO1 as v1, VO2 as v2

but it didn�t work. How can I make it?

thanks!
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Few things you might need to consider. If you have not, please check it out:

1> You need default constructor in all VO.

Moreover, can you submit your full code if possible. Use INstant UBB Code opation so it can be readable.

thanks,
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic