Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Can't serialize an embedded object

  1. #11
    Join Date
    Aug 2010
    Posts
    8

    Thumbs up

    Hi,
    I'm facing the same problem, trying to save a a new object with an embbed enum and using a simple repository :

    Code:
    @Document(collection="adjective")
    public class Adjective {
    	@Id
    	@NotNull
    	private String id ;
    	@NotNull
    	private AdjectiveType type ;
    
    //getter setter...
    }
    
    public enum AdjectiveType {
    	POSITIVE,
    	NEGATIVE;
    }
    Code:
    public interface AdjectiveRepository extends MongoRepository<Adjective, String> {
    }
    I get the same error doing the following:
    Code:
    	...
    	adjectiveRepository.save(myNewAdjective);
    Any workaround ?
    Thanks for your time

  2. #12
    Join Date
    Apr 2010
    Posts
    24

    Default

    which converter are you using?

    make sure you are using MappingMongoConverter


    Fede.

  3. #13
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    492

    Default

    What version are you using? There was a bug [1] we fixed recently. Please try a recent snapshot version.

    [1] https://jira.springsource.org/browse/DATADOC-136

  4. #14
    Join Date
    Aug 2010
    Posts
    8

    Default

    Thanks for the answer, I didn't saw this issue.
    I was using version 1.0.0.M2.
    I'm now trying with 1.0.0.BUILD-SNAPSHOT, but i'm probably missing something in my configuration with the new version since I get an error when the server is loading : "No bean named 'mongoDbFactory' is defined".
    I'll try to look deeper tomorrow and let you know how it goes.

    Quentin

  5. #15

  6. #16
    Join Date
    Aug 2010
    Posts
    8

    Default

    Thanks,
    Enum are now working fine with the snapshot, no error.

Posting Permissions

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