Menu

JPA @Transient annotation + flexjson

Help
Anonymous
2011-04-15
2015-06-10
  • Anonymous

    Anonymous - 2011-04-15

    Hello

    I have a JPA entity with a method named getXXX which flexjson assumes is a normal getter (though there's no setter and the getXXX method is annotated with @Transient) and which gets called when flexjson tries to serialize the JPA entity.

    Is there a way to tell flexjson to exclude getters annotated with an annotation?

     
  • Charlie Hubbard

    Charlie Hubbard - 2011-06-28

    Sorry I didn't see this post before now.  I didn't get notified it had been made.

    Yes you can use the @JSON(include=false) annotation on any getter/setter/field and flexjson will always exclude it.  If you want to include it later you can override that using the include() method.  But Flexjson doesn't pay attention to the @Transient notation right now.

    Charlie

     
  • Chris Marx

    Chris Marx - 2015-05-27

    wow, that is a great feature, i've been missing this for like 2 years, is this in the documentation some where?

     
  • Charlie Hubbard

    Charlie Hubbard - 2015-06-10

    It's been in there for a very long time. The website docs are a little behind due a misplaced ssh key. However, the docs in the zip file do discuss the feature so there has been docs out there, but just not on the website I'm afraid.

     

Log in to post a comment.

MongoDB Logo MongoDB