Search within Object Relational Mapping
Register / Login
Win a copy of
Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples
this week in the
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Object Relational Mapping
JPA native query, group function, different entity
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
I have got an exciting problem.
I have got the following native query:
String sql = "select max(nvl(a_date, b_dt)) as max_a" + ", min(nvl(a_date, b_dt)) as min_a" + ", max(c_dt_tm) as max_c" + ", min(c_dt_tm) as min_c" + " from date_table " + " where number " + " between '" + startNumber + "' " + " and '" + endNumber + "' " + " and c_dt_tm is not null";
As you see, this will return 4 different dates for me, and they need to populate another entity instead of date_table, which i got the values from.
So, this is the question:
"How can I select values from a table A to populate actually not the entity related to table A but an entity B related to table B?"
I am trying to use native query and resultSetMapping, but I keep getting an error, invalid column name from Hibernate. I don't know how could I do it not using nativequery.
I'd appreciate any help, thanks!
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
the value of filler advertising in 2021
Boost this thread!
how to pass array value in sql
Need help - Lot of joins are slowing down my query
Oracler Date function
Native query always returning same data
Regular expression - Pattern and matcher