Can someone give me some good suggestions on how to perform an efficient insert-select through using hibernate?? I don't want to use straight SQL because my application will support multiple database and I don't want to create individual SQL for each platform plus the insert-select statement changes according to user request. What is the best way to do an efficient insert-select by using Hibernate to simulate something like the following SQL statement without using static SQL:
INSERT INTO TABLE_1(VALUE1, VALUE2, VALUE3) SELECT
TABLE_2.VALUE1, TABLE_2.VALUE2, TABLE_3.VALUE3 FROM TABLE_2, TABLE_3
WHERE TABLE2.ID = TABLE_3.ID AND TABLE_2.VALUE4 = 'SOMETHING'. AND TABLE_3.VALUE5 = 'SOMETHING'
This is just an example SQL and the application uses different SELECT statements every time and select statement is generated by user.
Thanks
Vivian Fonger
Software Engineer
Socketware