Skip to content
Advertisement

How to get values of script sql to an object java

I have two object Person and Student Mapped with hibernate in my database and another object ObjectPR which brings together the two for showing values of two objects in same view

and this is my code java for getting list of ObjectPR

and this is my ObjectPR Class

and I got this error

Advertisement

Answer

I think the NEW operator syntax would be adequate here. And also as Student and Person are mapped classes, do not use the native SQL but a normal HQL query:

Remeber to add a proper constructro to the ObjectPR class.

Update

With native sql you would need to use an additional transformer like this:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement