[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-3033) Generate Hibernate/JPA - ManyToOne is more preferable choice than OneToOne
Vitali Yemialyanchyk (JIRA)
jira-events at lists.jboss.org
Wed Nov 26 10:37:36 EST 2008
[ https://jira.jboss.org/jira/browse/JBIDE-3033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12439892#action_12439892 ]
Vitali Yemialyanchyk commented on JBIDE-3033:
---------------------------------------------
I check result of my One2One generation - and have got an error - "Relationship must have an owner"
currently in one2one case i genarate smth. like this:
====
class Person
...
@OneToOne(mappedBy="person")
private Foto foto;
...
+++
public class Foto
...
@OneToOne(mappedBy="foto")
private Person person;
...
====
should be
====
class Person
...
@OneToOne(mappedBy="person")
private Foto foto;
...
+++
public class Foto
...
@OneToOne
@JoinColumn(name="fPersonId")
...
====
there are several unclear things here
1) which entity should be relationship owner - random selection is possible?
2) JoinColumn -> name - is not easy define correct value here...
so I doubt - should i return this case back to ManyToOne or change it to correct OneToOne generation
where 1) is random selection; 2) @JoinColumn(name="?") - generate this
> Generate Hibernate/JPA - ManyToOne is more preferable choice than OneToOne
> --------------------------------------------------------------------------
>
> Key: JBIDE-3033
> URL: https://jira.jboss.org/jira/browse/JBIDE-3033
> Project: Tools (JBoss Tools)
> Issue Type: Feature Request
> Components: Hibernate
> Affects Versions: 3.0.0.beta1
> Reporter: Vitali Yemialyanchyk
> Assignee: Anton Klimkovich
> Fix For: 3.0.0.cr1
>
>
> OneToOne relation is much more constrained than ManyToOne.
> So if there is no back reference - it is more likely this is ManyToOne relation.
> In the case of back reference existence - ManyToOne will always be a safe bet,
> so in this ambiguous case ManyToOne seems is a better choice -
> but this is thing for discussion - there are some questions here.
> + may be we should add some comments into sources.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosstools-issues
mailing list