Unfetched attribute access error


I have an entity Employee with two attributes Name which is an association of User and supervisor which is an association of Employee

I’m trying to set automatically the supervisor when creating a new Employee by getting the current logged userId and searching the employee where the name.id = userId then set that as the supervisor.

below is my code

my Service
public class PerformanceMangementServiceBean implements PerformanceMangementService {

private Persistence persistence;

public Employee getEmployee(UUID userId ) {
	Employee record;
	try( Transaction getEmployee= persistence.createTransaction())
		TypedQuery<Employee> querygetEmployee= persistence.getEntityManager().createQuery(
				"select e from finalpms$Employee e where e.name.id= :id" , Employee.class);
		querygetEmployee.setParameter("id", userId);
		record = querygetEmployee.getSingleResult();
	return record;


Employee editor

public class EmployeeEdit extends AbstractEditor<Employee> {
	private UserSessionSource userSessionSource;
    private DataManager dataManager;

	private PerformanceMangementService performanceMangementService;

	protected void initNewItem(Employee item) {
		// TODO Auto-generated method stub
		UUID userId = userSessionSource.getUserSession().getUser().getId(); 
			Employee record1;
			record1 = performanceMangementService.getEmployee(userId);


When i try to create from Employee browser i get this error


please help

Try to set view to your Employee search query querygetEmployee.setViewName("employee-view")

I will do that

Thank you