OT: JPA and related

1) Has anyone been able to get a unidirectional OneToMany working? I have tried Hibernate and OpenJPA and I can only get it working with a bidirectional.

2) We only go from the one to the many and very rarely go from the many to the one. Is that common?

3) I noticed that the IJ generated classes create the annotations for the ManyToOne side when it creates relationships, but it does not generate the annotations for the OneToMany side. Does this sound like a good request or at least an option?

0

1) Has anyone been able to get a unidirectional
OneToMany working? I have tried Hibernate and
OpenJPA and I can only get it working with a
bidirectional.

I was able to get a unidirectional OneToMany to work in Hibernate JPA by using @JoinColumn. This does not work in OpenJPA.

before:
@OneToMany(mappedBy = "userLogin", cascade = CascadeType.ALL)


after:
@OneToMany
@JoinColumn(name = "system_id")

0
Avatar
Permanently deleted user

I have The same problem after converting my project from IJ 6.0 and it's reason why I still can't test it any more :-/

0

Is the problem that you are having that you cannot create a uni-directional OnetoMany in OpenJPA/Kodo/WebLogic?

If so, I know what is happening. The IJ generated classes do not add annotations to primary key classes. I added @Column annotations to my primary key classes and was able to make a uni-directional @OneToMany just like I was in Hibernate.

0

请先登录再写评论。