【问题标题】:Create entity doesn't function创建实体不起作用
【发布时间】:2014-07-03 15:06:17
【问题描述】:

在我的 J2EE 应用程序中,我有类 Reservation。 要添加新的预订,我会这样做:

public boolean addReservation(Reservation r) {
    try{
    reservationFacade.create(r);
    }catch(Exception e){return false;};
    return true;
}

这会立即在我的数据库中添加一条新记录,但如果我在我的应用程序中执行 findAll(),我将看不到我的新预订!!

我有这个预订FacadeLocal:

@Local
public interface ReservationFacadeLocal {

void create(Reservation r);

void edit(Reservation r);

void remove(Reservation r);

Reservation find(Object id);

List<Reservation> findAll();

List<Reservation> findRange(int[] range);

int count();

}

【问题讨论】:

  • 重要的是实现,而不是接口。

标签: jakarta-ee ejb entity facade


【解决方案1】:

我解决了这个问题 em.refresh(实体);

【讨论】:

    猜你喜欢
    • 2018-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多