| public class StatefulSession1Bean implements StatefulSession1, Serializable
  | {
  |     @PersistenceContext
  |     private EntityManager manager;
  |     private Entity1 entity;
  | 
  |     public Entity1 createEntity1() {
  |         entity = new Entity1();
  |         return entity;
  |     }
  | 
  |     public boolean checkEqPointer(Entity1 entity) {
  |         return entity == this.entity;
  |     }
  | 
  |     public boolean checkEqEquals(Entity1 entity) {
  |         return entity.equals(this.entity);
  |     }
  | }
  | 

Futher code is called from a JSP:

  | InitialContext ctx = new InitialContext();
  | StatefulSession1 sess = (StatefulSession1) 
ctx.lookup("StatefulSession1Bean/remote");
  | 
  |     Entity1 ent1 = sess.createEntity1();
  | 
  |     out.println("checkEqPointer: " + sess.checkEqPointer(ent1));
  |     out.println("checkEqEquals: " + sess.checkEqEquals(ent1));
  | 

checkEqPointer (so called JVM equality) always returns "false"
checkEqEquals (DB equality) returns "true" if Entity1.equals is written 
correctly

Is it correct that checkEqPointer returns false? If yes, please give the 
reference to the section in EJB3 spec.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949378#3949378

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949378


_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to