Exception:
failed to lazily initialize a collection of role: com.cerner.budgetmanagement.model.Team.users, could not initialize proxy - no Session (through reference chain: com.cerner.budgetmanagement.model.Team["users"])
誰かがなぜこれが起こっているのか説明してください。私は春/冬眠環境でジャージーを使用することを学ぶ。この怠惰な初期化の私の理解は、セッションがスコープ外に出ていたためです。前もって感謝します。ロールのコレクションを遅延して初期化できませんでした:プロキシを初期化できませんでした - セッションなし
@SuppressWarnings({ "unchecked"})
@GET
@Path("/name/{teamId}")
@Produces(MediaType.APPLICATION_JSON)
public Response getBudgetPlan(@PathParam("teamId") int teamId) {
teamDao = applicationContext.getBean("dao", Dao.class);
final Team team = teamDao.getModelById(Team.class, teamId);
Hibernate.initialize(team);
return Response.status(201).entity(team).build();
}