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

Call relation getter before insert got error #989

Open
Syafiqq opened this issue Sep 1, 2019 · 0 comments
Open

Call relation getter before insert got error #989

Syafiqq opened this issue Sep 1, 2019 · 0 comments

Comments

@Syafiqq
Copy link

Syafiqq commented Sep 1, 2019

When I call getUser() on an entity that not inserted yet, it will throw DaoException: Entity is detached from DAO context instead of null. Is that normal?.

User Class:

public class User {
    @Id
    private Long id;
	// rest code
}

Note Class:

// Annotation
public class Note {
    @Id
    private Long id;
    private Long userId;
    @ToOne(joinProperty = "userId")
    private User user;
	// rest code
}

Reproduce step:

val note = Note()
assertThat(entity?.user, IsNull()) // This throws error instead of null
// Insert code
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