Code Monkey home page Code Monkey logo

Comments (5)

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Robert Stiller commented

I've forgot the siteService:

package example.service;

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

import example.Site;

public interface SiteService extends MongoRepository<Site, String>, QueryDslPredicateExecutor<Site> {
}

from spring-data-commons.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

That should have been fixed with 54ada02. Could you please try a current snapshot?

from spring-data-commons.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Robert Stiller commented

I figured out, that i did not specify a "collection" attribute in the @DBRef annotation.
It still does not work without it:

@Document(collection = "sites") //Doesn't work without the collection specified too
class Site {
    ...
    @DBRef
    protected Site parent;
    ...
}

But... if I specify the correct collection it works:

@Document(collection = "sites")
class Site {
    ...
    @DBRef(collection = "sites")
    protected Site parent;
    ...
}

I thought, that the object/class itself would be enough for @DBRef to figure out the correct collection.
So this may be a future feature :D

You should refer this issue in the documentation or try to figure out the correct collection using the class of the field annotated - if not explicitly specified (don't forgot a debug-log-message for automatically determined collections)

from spring-data-commons.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Robert Stiller commented

I've got another issue:

public class MyObject {
  ...
  protected Map<String, Attribute> attributes = new HashMap<String, Attribute>();
  ...
}
public class Attribute {
  ...
  protected String name;
  protected String value;
  protected Map<String, Attribute> children = new HashMap<String, Attribute>();
  ...
}

This causes the introspection to be terminated by a StackOverflowError, too.

You may fix it by breaking introspection on fields with a type(class) already introspected or now being introspected in the responsible method ...

One should also prevent endless loops caused by circular references. A detection with the corresponding Exception would be fine

from spring-data-commons.

spring-projects-issues avatar spring-projects-issues commented on May 2, 2024

Oliver Drotbohm commented

I've tweaked the algorithm of AbstractMappingContext a little so that it should now recognized already added PersistentEntity instances on recursive invocations. Made some refactorings in the TypeInformation part as well and added further tests to cover additional cases. Hope this one finally solves it for you (and us ;) )

from spring-data-commons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.