[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-1193) reverse engineering of UniqueConstraint annotation for function-based indexes

Steve Maring (JIRA) noreply at atlassian.com
Thu Oct 13 11:33:19 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44039#comment-44039 ] 

Steve Maring commented on HBX-1193:
-----------------------------------

log even shows:  INFO  [Dialect] Using dialect: org.hibernate.dialect.Oracle10gDialect

and then defaults to the JDBCMetaDataDialect ... so, perhaps the cause of my problems is a different bug

> reverse engineering of UniqueConstraint annotation for function-based indexes
> -----------------------------------------------------------------------------
>
>                 Key: HBX-1193
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1193
>             Project: Hibernate Tools
>          Issue Type: Bug
>          Components: hbm2java
>    Affects Versions: 3.2.4.GA
>            Reporter: Steve Maring
>              Labels: engineering, function-based, hbm2java, index, reverse, uniqueconstraint
>
> getting a runtime error ...
> [code]org.hibernate.AnnotationException: Unable to create unique key constraint (SYS_NC00048$) on table WRKR: SYS_NC00048$ not found[/code]
> the generated entity looks like this:
> [code]@Entity
> @Table(name="WRKR"
>     , uniqueConstraints = {  @UniqueConstraint(columnNames="SYS_NC00048$"),
>                                 @UniqueConstraint(columnNames="SYS_NC00047$"), 
>                                 @UniqueConstraint(columnNames="LOGIN_VAL"), 
>                                 @UniqueConstraint(columnNames="SOCL_SECUR_NUM_VAL"), 
>                                 @UniqueConstraint(columnNames="AD_LOGIN_VAL")} 
> )
> public class Wrkr  implements java.io.Serializable {[/code]
> Interesting thing is that this data seems to be coming from the table Indexes.  They read ...
> [code]
> Index Name		        Uniqueness	        Index Type		         Columns     	Column Expression
> IX_WRKR_01		        UNIQUE		NORMAL			        WRKR_SEQ	
> IX_WRKR_12		        UNIQUE		NORMAL			        SOCL_SECUR_NUM_VAL	
> IX_WRKR_16		        UNIQUE		FUNCTION-BASED NORMAL	SYS_NC00047$		UPPER("AD_LOGIN_VAL")
> IX_WRKR_17		        UNIQUE		FUNCTION-BASED NORMAL	SYS_NC00048$		UPPER("LOGIN_VAL")
> IX_WRKR_UQ_LOGIN_VAL	  UNIQUE		NORMAL			        LOGIN_VAL	
> IX_WRKR_UQ_AD_LOGIN_VAL	UNIQUE		NORMAL			        AD_LOGIN_VAL
> [/code]
> WRKR_SEQ is the primary key, and SOCL_SECUR_NUM_VAL, LOGIN_VAL, and AD_LOGIN_VAL are "real" columns.  The other two SYS_NC0004#$ are not actual columns in the table.  They seem to be some sort of "function-based" Oracle indexes/columns that you only see in the list of indexes.
> tried:
> <table name="WRKR">
> 		<column name="SYS_NC00047$" exclude="true"/>
> 		<column name="SYS_NC00048$" exclude="true"/>
> </table>
> but it didn't help.
> The problem seems to be isolated to the annotation generation.  I would venture to say that it should NOT be generating @UniqueConstraint entries for columns that don't actually exist in the table.

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

        


More information about the hibernate-issues mailing list