from two columns get one based on the value of another column passed in hibernate
posted 5 years ago
In My hbm file i need to write a query where i am passing the UserType and based on the userType whether the person is staff or manager, i should show two different account status to them.
i have a table where i have a primary key- id , userType , staffStatus , managerStatus.
i am passing id and userType to the namedQuery , based on the userType - if it is staff the i have to return staffStatus or if it is managerType then i have to return managerStatus.
Can anyone help me in writing this query , i could so it using DECODE in normal pl/sql but could not make that workout in hbm file