• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate composite id mapping through HQL

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i have table with composite PK:

and i need other table to join it with many-to-one relationship:

the name="kategoria" stands for name of column in Zadanie table which contains id value of Ciselnik table.
But the problem is that my class Zadanie contans only ID column of Ciselnik class and i need to specify typ and jazyk in HQL Query, but i have no idea what i need to specify in my Zadanie class and how to write HQL Query.

Please keep in mind that i'm very new to hibernate and and i'm rewriting existing model to use hibernate, so i wouldn't like to change DB schema.

Thank you
Adam Kovari
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Adam Kovari:
[QB]Hi,
i have table with composite PK:


Hi Kovari,

Please use a separate bean for composite id's. Make sure that this class should be SERIALIZED. When you writing your HQL's you need to pass the PK from the created one.

~Ramesh

 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic