1

I use siena with google engine. I have a model class with a field (named secret) that I don't want to be persisted. (I don't want the column to be created in the google datastore)

Something along the lines of

Class person {
   @Id 
   public Long id ; 

   public String name ; 

   @Ignore
   public String secret ;

}

The field secrethas to be public.

Do you have any idea to achieve that ?

Name is carl
  • 5,961
  • 3
  • 29
  • 44

1 Answers1

5

You can use Java's transient keyword:

public transient String secret;

That should stop it from being persisted.

David Lavender
  • 8,021
  • 3
  • 35
  • 55
  • Damn, I shouldn't have looked it up and I would have beat you... +1! – 11684 Jan 25 '13 at 13:32
  • Too bad there is not something Siena specific. Because now I can't serialize the "secret" field either. After all sometimes you may want to read data from your filesystem and not persist all of it. Then again you can create DTO... – Name is carl Feb 20 '13 at 01:29
  • There is change request on the siena project to add the @Ignore annotation. https://github.com/mandubian/siena/pull/24 – Name is carl Feb 22 '13 at 10:39