users@glassfish.java.net

Re: Questions on EJB 3.0 and data retrieval.

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 May 2007 11:14:00 PDT

> My guess is that this is a feature not a bug (lol in
> reference to MS)
>
> Actually I think it is intended behavior to cache
> objects in the container. I am just not sure how to
> overcome the problem. It would be nice if the EJBs
> were the only thing that manipulated the data source
> and the container could cache everything, but in the
> real world that just isn't true.

I checked with the last build and nothing changed.
This time I tested more carefully.
So now I'm sure about this effect.

Ok, I have only one idea that could be reason it's not the bug.
Did you make your persistence entity with help netbeans?

Do your entity has methods such as:

        @Override
        public int hashCode() {
                int hash = 0;
                hash += (this.id != null ? this.id.hashCode() : 0);
                return hash;
        }

        @Override
        public boolean equals(Object object) {
                if (!(object instanceof Patient)) {
                        return false;
                }
                Patient other = (Patient)object;
                if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
                return true;
        }
[Message sent by forum member 'vladperl' (vladperl)]

http://forums.java.net/jive/thread.jspa?messageID=216367