ひがやすを技術ブログ

電通国際情報サービスのプログラマ

Statelessのinstance属性

これまで、@Statelessは、instance属性をprototypeにマッピングしていたのですが、core-ejbの3.4.5.2に


All business object references of the same interface type for the same stateless session bean have the same object identity, which is assigned by the container.

@EJB Cart cart1;
@EJB Cart cart2;
...
if (cart1.equals(cart1)) { // this test must return true
...
}
if (cart1.equals(cart2)) { // this test must also return true
...
}

と書いているので、singletonにマッピングするように変更したいと思います。