Announcement Announcement Module
Collapse
No announcement yet.
@Transient annotation being ignored - Spring MongoDB - 1.0.0.M2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Transient annotation being ignored - Spring MongoDB - 1.0.0.M2

    Hi

    I'm trying to use the @Transient annotation (org.springframework.data.annotation.Transient) to prevent a class property from being written to the database, but the value gets written anyway.

    Is there a bug or am I doing something wrong?

    Thanks in advance.

    Derek

  • #2
    Hi,

    Have you configured to use the MappingMongoConverter? See here for how.

    Mark

    Comment


    • #3
      Hi Mark

      Thanks for the reply.

      Sorry if I'm missing something obvious but how does that relate to this issue?

      Derek

      Comment


      • #4
        Annotation based mapping only works if you're using the MappingMongoConverter as backing converter for MongoTemplate. If you're not configuring the converter a SimpleMongoConverter will be used by default that simply serializes objects into Mongo without taking a look at any meta information whatsoever.

        Cheers,
        Ollie

        Comment


        • #5
          Thanks Ollie, that works perfectly now.

          Much appreciated.

          Derek

          Comment

          Working...
          X