Apr 13th, 2011, 04:11 PM
@Transient annotation being ignored - Spring MongoDB - 1.0.0.M2
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.
Apr 19th, 2011, 09:03 AM
Have you configured to use the MappingMongoConverter? See here for how.
May 1st, 2011, 07:59 AM
Thanks for the reply.
Sorry if I'm missing something obvious but how does that relate to this issue?
May 1st, 2011, 11:56 AM
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.
May 1st, 2011, 02:25 PM
Thanks Ollie, that works perfectly now.
Tags for this Thread