Announcement Announcement Module
Collapse
No announcement yet.
MongoDB Lifecycle events not being initialized Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MongoDB Lifecycle events not being initialized

    After I register:
    <bean class="com.xxx.event.OnAfterConvertUserEventListen er"/>

    I would expect the below method "userRepository.findByUsername" to initiate the aforementioned bean. It doesn't. In the docs, it says that if I use findOne(), it will pick it up.

    It does work when I call userRepository.findAll().

    @Repository("userRepository")
    public class MongoUserRepository extends QueryDslMongoRepository<User, String> implements UserRepository {
    QUser user = QUser.user;

    @Autowired
    public MongoUserRepository(MongoTemplate mongoTemplate) {
    super(new MappingMongoEntityInformation<User, String>(
    new BasicMongoPersistentEntity<User>(
    new ClassTypeInformation<User>(User.class))
    ), mongoTemplate
    );
    }

    @Override
    public User findByUsername(String username) {
    return findOne(user.username.eq(username));
    }
    }

    Interface:
    public interface UserRepository extends PagingAndSortingRepository<User, String>, QueryDslPredicateExecutor<User> {

    User findByUsername(String username);
    }
    Last edited by bjornharvold; Jun 22nd, 2011, 01:03 PM.

  • #2
    Created ticket here: https://jira.springsource.org/browse/DATADOC-179

    Comment


    • #3
      It does work if I do not implement my own Repository but instead use <mongo:repositories base-package="com.xxxx.repository"/>

      Comment

      Working...
      X