Results 1 to 5 of 5

Thread: @Transient annotation being ignored - Spring MongoDB - 1.0.0.M2

  1. #1
    Join Date
    Apr 2011
    Posts
    7

    Default @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. #2
    Join Date
    Aug 2004
    Location
    New York, NY
    Posts
    74

    Default

    Hi,

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

    Mark

  3. #3
    Join Date
    Apr 2011
    Posts
    7

    Default

    Hi Mark

    Thanks for the reply.

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

    Derek

  4. #4
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    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

  5. #5
    Join Date
    Apr 2011
    Posts
    7

    Default

    Thanks Ollie, that works perfectly now.

    Much appreciated.

    Derek

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •