Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full example for MongoDb #119

Open
azizasm opened this issue Oct 28, 2016 · 0 comments
Open

Full example for MongoDb #119

azizasm opened this issue Oct 28, 2016 · 0 comments

Comments

@azizasm
Copy link

azizasm commented Oct 28, 2016

Appreciate if there is full example on how to configure this spring-mvc-quickstart-archetype to mongoDb.

Based on current document by adding having error :
@EnableMongoRepositories(basePackageClasses = Application.class)

AccoutRepository.java

import org.springframework.data.mongodb.repository.MongoRepository;

@Repository
public interface AccountRepository extends MongoRepository<Account, Long> {
    Account findOneByEmail(String email);
}

Error:

2016-10-28 09:20:09.879 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.accountService': Invocation of init method failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Can
not autogenerate id of type java.lang.Long for entity of type my.groupid.account.Account!
        at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant