java - Relational Data is Not Fetching in Ebean -


background

I am using (Java) to store data. The Play Framework uses to convert classes into data that can be stored in the database.

The problem

I am currently having trouble bringing the relational data completely. I have a user and a UserEmail model. user can be multiple UserEmail s


When I try and user , then the user data is loaded properly, but is not usermail s.



When I specifically code to fetch fetch ("email")

  User.find.fetch ( "E-mail"). where (). Eq ("userId", testUserId) .findUnique ();  

This gets at least email as it does the limit, though when I try and show them through

  return (Jason. Tosan (Retrieved Test User));  

I get

question

is there any way I get the game structure / EBI automatically without having receiving the email Can "email") in every query? Maybe a comment?

How do I solve the above error? Why is it thrown away, but how can I fix it? Is there any way by which only one level is deep?

I found the solution to the above problem, each unit should have an ID. The annotated field with user class has @ id but is not UserEmail . After adding @ id above the comment email area UserEmail class user has been brought properly and its email list is not empty

.

@ id public string email;

One more thing I saw in your code:
When you are creating bidirectional relationships, to give you an indication that on one side mapped by The attribute should be used, there are two ends of a relationship and there are two separate relations, therefore it should be:

  @OneToMany (mapped = "user", cascade = cascade type.Al) @ Barriers Mandatory public list & lt; UserEmail & gt; E-mail;  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -