0

I have a requirement where I am adding new column from a select query like this:

select 
    sy.FIRST_NAME || sy.LAST_NAME as full_name, 
    e.* 
from 
    employee e 
left join 
    USERS sy on sy.SY_USER_ID = act.SY_USER_ID;

I have all the columns of the employee table in my entity class as fields - except for full_name.

How to map this full_name column to a field in my entity class?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Nava1119
  • 13
  • 1
  • 6
  • What do you want to happen when you try to write or update a name value, or add a new Employee? How are these User columns mapped to your object model? If User is an extension of Employee (or the other way around), you might have an Employee object that extends a User entity via multi table inheritance. Or use a SecondaryTable annotation to map User fields to the Employee. It then should be trivial to add firstName lastName properties which you can expose (or not) through get/setFullName methods. – Chris Mar 07 '22 at 19:50

1 Answers1

0

I believe you have columns first_name and last_name as you use to create full_name column. Therefore, you already mapped the full_name column to align with all previous columns in the table. Try run your SQL.

iris2908
  • 1
  • 2
  • My bad, I have not put that properly in the question, first and last name values are from different table which I got from a join, I have entity created for employee not the other class. – Nava1119 Mar 07 '22 at 10:06