Announcement Announcement Module
Collapse
No announcement yet.
@TypeAlias not working (MongoDB) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @TypeAlias not working (MongoDB)

    My records are getting persisted perfectly except for the _class value, so I wrote the following dummy class to isolate the problem.

    package test;

    import org.springframework.data.annotation.TypeAlias;

    @TypeAlias(value="FOOO")
    public class Data {
    String name;
    }

    The Data records getting persisted still have "_class=test.Data" in them.


    Pretty sure I've done a silly mistake; not sure what.

  • #2
    Did you ever figure this out?

    We're having the same problem - did you ever figure this out?

    Comment


    • #3
      Check your xml configuration

      <mongo:mapping-converter id="mappingConverter" base-package="x.y.z">
      ...
      </mongo:mapping-converter>

      That picked up my classes in that package with the @TypeAlias and changed the _class attribute accordingly

      Comment

      Working...
      X