[jbosstools-issues] [JBoss JIRA] (JBIDE-12637) Hibernate Tools generates @SequenceGenerator with not unique name

Max Rydahl Andersen (JIRA) jira-events at lists.jboss.org
Mon Nov 19 10:49:21 EST 2012


    [ https://issues.jboss.org/browse/JBIDE-12637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735364#comment-12735364 ] 

Max Rydahl Andersen commented on JBIDE-12637:
---------------------------------------------

tricky to fix - have to wait.
                
> Hibernate Tools generates @SequenceGenerator with not unique name
> -----------------------------------------------------------------
>
>                 Key: JBIDE-12637
>                 URL: https://issues.jboss.org/browse/JBIDE-12637
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: hibernate
>    Affects Versions: 4.0.0.Alpha1
>            Reporter: Nicolas Bihan
>            Assignee: Koen Aers
>            Priority: Blocker
>              Labels: SequenceGenerator, hibenate, hibernate-tools, jpa
>             Fix For: 4.1.x, 4.0.x
>
>
> When generating entities with EJB3 annotations with a strategy set to "sequence", Hibernate tools generates POJOs with non unique javax.persistence.SequenceGenerator name "generator". But according to the Java documentation :
> bq. String name (Required) A unique generator name that can be referenced by one or more classes to be the generator for primary key values.
> See [javadoc|http://docs.oracle.com/javaee/5/api/javax/persistence/SequenceGenerator.html]
> Exemple of generated code with 4.0.0 Alpha1:
> {code}
> @SequenceGenerator(name = "generator", sequenceName = "S_CLIENT")
>    @Id
>    @GeneratedValue(strategy = SEQUENCE, generator = "generator")
>    @Column(name = "CLIENT_ID", unique = true, nullable = false, precision = 22, scale = 0)
>    public long getClientId() {
>       return this.clientId;
>    }
> {code}
> [Source code|https://github.com/hibernate/hibernate-tools/blob/master/src/java/org/hibernate/tool/hbm2x/pojo/EntityPOJOClass.java#L243] can be seen here.
> So looks like the //TODO comment is right and it should generate a unique name atribute. sequencename+"generator" would be a good name.
> It would even be better if we could define this name in reveng.xml or/and in a DelegatingReverseEngineeringStrategy class. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list