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

Exception encountered when saving relmongo annotated entity via Spring Data Repository #10

Closed
mancini0 opened this issue Jun 14, 2018 · 3 comments

Comments

@mancini0
Copy link

mancini0 commented Jun 14, 2018

    <dependency>
      <groupId>io.github.kaiso.relmongo</groupId>
      <artifactId>relmongo</artifactId>
      <version>1.0.0-RC2</version>
    </dependency>
<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-mongodb</artifactId>
    </dependency> //Using Spring Boot 2.0.2 dependency management 
public interface UserRepository  extends CrudRepository<User,String> {

}
public interface ApplicationRepository extends CrudRepository<Application,String> {
}
@Data
@Document
@Builder
public class User {
  @Id @NotBlank
  private String id;
  private String name;
  @OneToMany(fetch=FetchType.EAGER)
  @Singular
  private Set<Application> apps;
}
@Data
@Document
@Builder
public class Application {
  @Id
  //@NotBlank
  @Length(max =250)
  private String uuid;
  //@NotBlank
  @Length(max=50)
  private String name;
  private String version;
  private Date updatedAt;
  //@NotBlank
   @Length(max=500)
  private String summary;
  @URL
  //@NotBlank
  private String icon;
  private String description;
  @Valid
  @Singular
  private List<AccessUrl> urls;

  @Valid
  private Support support;
}
  @Autowired
  private ApplicationRepository appRepo;

  @Autowired
  private UserRepository userRepo;

...

    appRepo.save(app1);
    appRepo.save(app2);
    appRepo.save(app3);
    userRepo.save(user1);
java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.event.BeforeSaveEvent.getDBObject()Lcom/mongodb/DBObject;
	at ****io.github.kaiso.relmongo**.events.listener.MongoEventListener.onBeforeSave**(MongoEventListener.java:53) ~[relmongo-1.0.0-RC2.jar:na]
@kaiso
Copy link
Owner

kaiso commented Jun 15, 2018

Thank you for posting this issue.
Currently RelMongo is compatible with spring-boot 1.5.X versions so with spring-data-mongodb 1.10.X.
In the version 2.0 the compatibility will be ported to spring-boot 2.X and compatible spring-data-mongo-dependency.

For the moment you can solve your problem by excluding the spring-data-mongodb from spring boot dependencies and add this dependency to your project :
``

   <dependency>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-mongodb</artifactId>
                    <version>1.10.11.RELEASE</version>
  </dependecy>

``

@kaiso
Copy link
Owner

kaiso commented Jun 15, 2018

Hi a new pre-release ( 2.0.0-RC1) to work with spring-boot 2.X.X was published please see compatibility matrix

@mancini0
Copy link
Author

Thanks, I am able to bring the app up using either 1.5.3 or 2.0.2 when following the compatability matrix.

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

2 participants