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

Improve mongodb reference handling #803

Closed
timowest opened this issue Jun 13, 2014 · 15 comments
Closed

Improve mongodb reference handling #803

timowest opened this issue Jun 13, 2014 · 15 comments
Milestone

Comments

@timowest
Copy link
Member

@timowest timowest commented Jun 13, 2014

In eq and ne operations reference cases are not handled properly.

timowest added a commit that referenced this issue Jun 13, 2014
@timowest timowest added the fixed label Jun 13, 2014
@timowest timowest added this to the 3.4.1 milestone Jun 13, 2014
@timowest timowest modified the milestone: 3.4.1 Jun 25, 2014
@timowest
Copy link
Member Author

@timowest timowest commented Jun 29, 2014

Released in 3.4.1

@timowest timowest closed this Jun 29, 2014
christophstrobl added a commit to spring-projects/spring-data-mongodb that referenced this issue Jul 9, 2014
SpringDataMongodbSerializer now uses the overrides for isReference and asReference to create the appropriate DBRef objects when serializing. 

Therefore we look for the meta-annotation @reference and inspect the given Path to determine the property and its meta information like ‘collection’.

The change will only take effect when using QueryDSL 3.4.1 and above. See querydsl/querydsl#803 for details.
christophstrobl added a commit to spring-projects/spring-data-mongodb that referenced this issue Jul 9, 2014
SpringDataMongodbSerializer now overrides the necessary methods to create the appropriate DBRef objects when serializing data via Querydsl.

We currently disable the test case as it the fix taking effect requires Querydsl 3.4.1 which unfortunately breaks Java 6 compatibility. We include the fix nonetheless to allow users on Java 7 to potentially use the latest Querydsl.

Original pull request: #203.
Related tickets: querydsl/querydsl#803.
christophstrobl added a commit to spring-projects/spring-data-mongodb that referenced this issue Jul 9, 2014
SpringDataMongodbSerializer now overrides the necessary methods to create the appropriate DBRef objects when serializing data via Querydsl.

We currently disable the test case as it the fix taking effect requires Querydsl 3.4.1 which unfortunately breaks Java 6 compatibility. We include the fix nonetheless to allow users on Java 7 to potentially use the latest Querydsl.

Original pull request: #203.
Related tickets: querydsl/querydsl#803.
@simonered
Copy link

@simonered simonered commented Feb 29, 2016

Seems not working anymore...

@timowest
Copy link
Member Author

@timowest timowest commented Feb 29, 2016

@simonered What failure do you get? Which version?

@simonered
Copy link

@simonered simonered commented Feb 29, 2016

Latest version (3.7.1)...trying to use eq on reference's $id, with no luck.

This is my simplified code:

 public class Book {
     @DBRef
     private Library library;
 } 

public class Library {
     @Id
     private String id;
 }

[...]

QBook book = QBook.book;
BooleanExpression b = book.library.id.eq([some_id]);
Predicate p = ExpressionUtils.and(null, b);

List<Book> list = bookRepository.findAll(p);  // EMPTY

Custom method in mongo repository bookRepository.findByLibraryId(String id) returns the items i'm expecting

@timowest
Copy link
Member Author

@timowest timowest commented Feb 29, 2016

is this with Spring Data?

@simonered
Copy link

@simonered simonered commented Feb 29, 2016

Yes

@timowest
Copy link
Member Author

@timowest timowest commented Feb 29, 2016

then the related template methods might not have been overridden in the version you use.

@simonered
Copy link

@simonered simonered commented Feb 29, 2016

The case is the same as the original StackOverflow question

@simonered
Copy link

@simonered simonered commented Feb 29, 2016

What to you mean for "not been overridden"? What should I have to do?

@simonered
Copy link

@simonered simonered commented Mar 1, 2016

So the issue is confirmed or should I have to do something else to make it work?

@timowest
Copy link
Member Author

@timowest timowest commented Mar 5, 2016

@simonered
Copy link

@simonered simonered commented Mar 5, 2016

I'm using Spring Data MongoDB 1.8.1 (coming from spring boot 1.3.2)

@simonered
Copy link

@simonered simonered commented Mar 7, 2016

Tried to update Spring Data to latest version 1.8.4, but the issue is still present.

@simonered
Copy link

@simonered simonered commented Mar 8, 2016

I think the issue should be reopened.

@timowest
Copy link
Member Author

@timowest timowest commented Mar 8, 2016

The Spring Data Mongodb Querydsl bindings are maintained by Spring Data, not by us, it seems to be caused by their Querydsl bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.