[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-701) Using @CollectionId annotation breaks schema generation
Tim Evers (JIRA)
noreply at atlassian.com
Sun Mar 9 19:06:33 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29739 ]
Tim Evers commented on ANN-701:
-------------------------------
Ok, I've uploaded the Entity and the Embeddable classes to show the problem I'm having.
I have been trying to get this working and I have used 2 different databases and I'm getting the same issue on both databases.
So I'm pretty sure this is not an Ingres issue here. And I have been able to reproduce this using MySQL.
This is the SQL being generated for the creation of the schema.
08:56:53.176 [main] gekko-pool [] create table pr_tenure (n_key_tenure bigint not null, d_created date, d_updated date, f_active bit not null, d_expiry date, t_file_ref varchar(255), d_commencement_date date not null, t_customer_ref varchar(255), n_deposit numeric(19,2), d_expiry_date date, d_final_payment_cert_date date, t_elvas_case_id varchar(255), t_final_payment_cert_number varchar(255), n_purchase_price numeric(19,2), f_residential bit, t_service_addressee varchar(255) not null, c_account_type varchar(255) not null, c_rent_type varchar(255), t_source varchar(250), c_tenure_status varchar(255), t_subdivision varchar(255), c_lease_purpose varchar(255), t_tenure_ref_no varchar(255), c_tenure_type varchar(255), t_title_ref varchar(255), n_key_tenure_customer bigint, n_key_financial_group bigint not null, n_key_service_address bigint not null, n_key_ligislative_group bigint not null, n_key_user_created bigint, n_key_land bigint, n_key_proposal bigint, n_key_user_updated bigint, primary key (n_key_tenure)); (16 milliseconds)
08:56:53.192 [main] gekko-pool [] create table pr_tenure_account (n_key_tenure bigint not null, d_commencement_date date not null, t_customer_ref varchar(255), n_deposit numeric(19,2), d_expiry_date date, date date, finalPaymentCertElvasCaseId varchar(255), finalPaymentCertNumber varchar(255), n_key_financial_group bigint not null, n_key_ligislative_group bigint not null, n_purchase_price numeric(19,2), f_residential bit, n_key_service_address bigint not null, t_service_addressee varchar(255) not null, c_account_type varchar(255) not null, n_index_order integer not null, primary key (n_key_tenure, n_index_order)); (16 milliseconds)
As you can see it is not sending the @CollectionId column information in the SQL.
>From what I understand the sql should be creating the column n_key_account (referring to the attached files).
Could you please advise what else I can try?
A couple of things I'd like to know are:
What is the SQL being generated by your tests?
and
What database are you using?
> Using @CollectionId annotation breaks schema generation
> -------------------------------------------------------
>
> Key: ANN-701
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-701
> Project: Hibernate Annotations
> Issue Type: Bug
> Environment: Hibernate version: 3.2.5 GA
> Hibernate Annotations version: 3.3.0 GA
> Ingres Database 2006
> Reporter: Tim Evers
> Attachments: Account.java, Tenure.java
>
>
> Basically, if I use the org.hibernate.annotations.CollectionId annotation, for some reason, hibernate won't generate the table for the mapping.
> This works:
> @CollectionOfElements
> @JoinTable(
> name = "contact",
> joinColumns = @JoinColumn(name = "n_key_person"))
> @IndexColumn(name = "n_index_order")
> This doesn't:
> @CollectionOfElements
> @JoinTable(
> name = "contact",
> joinColumns = @JoinColumn(name = "n_key_person"))
> @CollectionId(
> columns = @Column(name = "n_key_contact"),
> type = @Type(type = "long"),
> generator = "increment" )
> It fails when it tries to select from the contact table, because it didn't get created.
> The @CollectionId mapping seems to work exactly the way I want if I go create the contact table manually.
> Forum topic here:
> http://forums.hibernate.org/viewtopic.php?t=980254&highlight=collectionid+schema
--
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