Hi
I think my problem is quite simple but have no idea how to handle it.
As a result of hibernate query I want to get collection of objects. Each of them is filled with data taken from several tables. I need this data only for read only purposes. Let's see an example:
There are tables: USER (id, name), ORDER(id,user_id,date)
I want to get a collection of rows, each of them consists of two columns:
order_id, user_name, based on joining above tables.
The problem is that I have only one class that I can use as a container : OrderRow, that has two fields orderId and userName and setters and getters for that fields.
The second assumption is that I don't have mappings for objects User and Order in my hbm file. This is because that tables are filled with data by another application. In my application I only need them for report pupropses. In other words, let's assume sql query:
select o.id as id,u.name as name from ORDER o left join USER u ON o.user_id = u.id
I just want to dynamic fill the OrderRow objects list with data from above query without having mapping for both entity tables ORDER and USER .
I thought it would be possible with hibernate dynamic initialization but in that case I think I have to specify mappings for User and Order entities and create classes (User and Order), but I don't want to. Is there any other possibility???
Thanks
Bartek
|