[jbosstools-issues] [JBoss JIRA] Updated: (JBIDE-7568) Code generation for JPA 2.0 uses old features

Max Andersen (JIRA) jira-events at lists.jboss.org
Fri Nov 12 08:14:37 EST 2010


     [ https://jira.jboss.org/browse/JBIDE-7568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Max Andersen updated JBIDE-7568:
--------------------------------

       Issue Type: Feature Request  (was: Bug)
    Fix Version/s: 3.2.x


Where are you "selecting JPA 2 for generation" ?

Want to be sure we are actually talking hibernate tools generation of if you are using something else (i.e. Dali JPA generation)


but putting on 3.2.x/3.3.x since I don't see we can fix this before GA well enough.
and its a feature request (not a bug since things still work ;)

> Code generation for JPA 2.0 uses old features
> ---------------------------------------------
>
>                 Key: JBIDE-7568
>                 URL: https://jira.jboss.org/browse/JBIDE-7568
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: Hibernate
>    Affects Versions: 3.2.0.Beta1
>            Reporter: Juergen Zimmermann
>            Assignee: Max Andersen
>             Fix For: 3.2.x
>
>
> When choosing JPA 2.0 for code generation, then @OneToMany and @ManyToOne still generates relationships as in JPA 1.0. But the JPA 2.0 style is definitely better esspecially when it comes to unidirectional relationships where you just want to delete one side of the bidirectional relationship.
> Example: one customer has many orders
> @Entity
> @Table(name = "customer")
> public class Customer implements Serializable {
> ...
> 	@OneToMany
> 	@JoinColumn(name = "customer_fk")  // foreign key in table "order"
> 	private Set<Order> orders;
> @Entity
> @Table(name = "order")
> public class Order implements Serializable {
> ...
> 	@ManyToOne
> 	@JoinColumn(name = "customer_fk", insertable = false, updatable = false)
> 	private Customer customer;
> As you can see: the foreign key is declared at both sides of the relationship so that one side can easily ommitted to just have a unidirectional relationship.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list