users@glassfish.java.net

Persistence, ignoring a class field

From: Kenneth Clark <kenneth_at_rabiddog.co.za>
Date: Mon, 08 Jan 2007 18:01:56 +0200

Hi all

I have search high and low and cannot figure this out.
I have to classes, one for a StaffMember and another one containing the
credentials for the staff member. The reason I decided to separate them
is because the staff member details are stored in an SQL DB and the user
details are stored inside and LDAP server.

I would like to map the staff member as an entity and tell the entity to
ignore the credentials.

Now I see no "Ignore" or anything similar annotation.

I have accessors for the credentials prefixed with get and set. I assume
the annotation processing engine looks at the get and set prefixes to
derive the fields/properties it needs to persist. Would prefixing the
accessors with something other than get or set make the engine ignore
the methods? Is there a less contrived way of doing this?

@Entity
class StaffMember{
    private Credentials credentials; //<-- I want to ignore this.

    public Credentials getCredentials(){
       //impl
    }
    public void setCredentials(Credentials value){
      //impl
    }
   
}


Thanks for all your help
Kenneth