é errado usar os metodos abaixo quando tento usar find e merge junto da erro EntityManager is close ???
não entendi pois quando uso o find vou dar um select e qdo saio fecho
e vou tentar dar um update …
O conceito não seria o mesmo qdo se usa JDBC (COnnection,preparedStatement) a cada acesso fechar
pra não deixar conexão no banco em aberto …???
se alguém puder me ajudar …
public T find(T entity) throws DaoException {
T t = null;
try {
t = dMANAGER.getManager().find(domainClass, entity);
return t;
} catch(Exception e) {
throw new DaoException(getErrorCode(METHOD_FIND_BY_CLASS), "Can not find by Class", e);
}finally{
dMANAGER.Close();
}
}
public void remove(T t) throws DaoException {
try {
dMANAGER.getManager().merge(t);
} catch(Exception e) {
throw new DaoException(getErrorCode(METHOD_REMOVE), "Can not remove", e);
}finally{
dMANAGER.Close();
}
}