ejb 3.0 - Doubt regarding JPA namedquery -
i trying execute namedquery
@namedquery(name="getemployeedetails",query="select e.username,e.email,e.image,e.firstname,e.lastname employee e e.empid=?1")
now when execute query in ejb 3.0 session bean object should return.i tried returning listits returning vector creates classcast exception.the employee table contains fields password , other confidential details don't want fetch.so not using select e employee e
. learning jpa can help.
below sample query fetches required fields, have make such constructor it.
query : select new package_name.employee(e.username,e.email,e.image,e.firstname,e.lastname) employee e e.empid=?1;
it return employee entity selected fields & remaining have default values.
Comments
Post a Comment