Help coderanch get a
new server
by contributing to the fundraiser
  • 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 session

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

This is my first dab at hibernate and have come across a situation wherein

1. i have a collection of POJO objects
2. the object has a property called areaId
3. I need to use this property in query in the where clause with a join with another table.

i can at the moment i can do this in 2 ways

1. use the IN clause in - problem my list can have more than 1000 objects where the query with the IN clause will start complaining
2. create a temporary table and join this temp table in my query - want to avoid this

Is there some way to save this collection of POJO objects into the hibernate session and use this to create a select query with an existing table.

e.g.
select * from table1 t, temp_table tt where t.id = tt.id

I want to avoid using temp_table

cheers
Jack
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you describe a little more about the data and object model. I am a little bit confused. are the ids of the tables already PK/FK relationships that you have mapped? Is the areaid a FK? is areaid mapped to a field in a table?

Thanks

Mark
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic