[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5189) Same table is mapped twice but different primary keys. Giving error while secondPassCompileForeignKeys.

Sardar Romender Singh (JIRA) noreply at atlassian.com
Mon May 3 23:55:28 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=36869#action_36869 ] 

Sardar Romender Singh commented on HHH-5189:
--------------------------------------------

While browsing the code i found that hibernate will handle when we give the subselect. but it will never handle when we have where clause in the mapping file.

If CustomerLight is mapped using subselect it works properly without any error.But when its mapped to the table and having the where clause it gives the Foriegn constraint voilation while secondPassCompileForiegnKeys It doesn't consider the Where clause.

> Same table is mapped twice but different primary keys. Giving error while secondPassCompileForeignKeys.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5189
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5189
>             Project: Hibernate Core
>          Issue Type: Bug
>         Environment: OS: Linux
> DB : Oracle
> Hibernate Version : 3.2.5 ga
>            Reporter: Sardar Romender Singh
>            Priority: Trivial
>
> Two tables are mapped with different primary keys. 
> Example :
> I have customer table which is mapped to Customer Entity whose primary keys are Customer id and status (which says authorized customer or un authorized customer). 
> I have one more entity mapped to same table CustomerLight which will load only some specific fields of the customer which contains the where clause which specifies to load only authorized customer.
> There are some more entities which are mapped to customer entity with key-many-to-one relationship.
> After loading of the mapping file while validation of foriegn key constraints its failing 
> Foreign key constraint failed "must have same number of columns as the referenced primary key"
> This is happening only in some environments not all.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list