[Hibernate-JIRA] Created: (HHH-3864) "missing table" when hibernate.hbm2ddl.auto=validate and the database has tables named with SQL keywords
by Oswaldo Dantas (JIRA)
"missing table" when hibernate.hbm2ddl.auto=validate and the database has tables named with SQL keywords
--------------------------------------------------------------------------------------------------------
Key: HHH-3864
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3864
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: JBoss AS 5.0.1, JBoss Seam 2.1.1.GA, Hibernate 3.3.1, SQL Server 2000, jTDS 1.2.2 for JDBC, Eclipse 3.4.2, JBoss Tools 3.0.0.GA
Reporter: Oswaldo Dantas
Priority: Minor
Created a Seam Web Project in Eclipse and used the "Seam Generate Entities" wizard selecting some tables.
For instance, a table named User gets mapped with the annotation:
@Table(name = "USER", ...
Using this, the JDBC throws a invalid syntax near keyword USER
For this to work, the name must be escaped with braces:
@Table(name = "[USER]", ...
This work in the Eclipse Hibernate perspective, the Session Factory gets instanciated and HQL queries can be done, but when deploying to JBoss it throws a "missing table: [USER]" and aborts the deployment.
Then, after changing hibernate.hbm2ddl.auto=validate to NONE in persistence.xml, the project can be deployed and opened in the browser, "everything works".
So maybe there are two points here:
The generated mapping could escape names that could conflict with SQL keywords in different known dialects.
The validation on the deployment should understand the escaped names so it can be enabled without the "missing table" error.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Created: (HHH-3861) Wrong sql query with join table strategy
by Vitaliy Morarian (JIRA)
Wrong sql query with join table strategy
----------------------------------------
Key: HHH-3861
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3861
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Reporter: Vitaliy Morarian
I have found that use of join table strategy results wrong query. Changing strategy to joined-subclass works ok.
produced SQL with join-table:
---
/* load one-to-many com.uwiss.hr.domain.Company.customers */ select customers0_.company_id as company11_3_, customers0_.person_id as person1_3_, customers0_.person_id as person1_16_2_, customers0_.version as version16_2_, customers0_.contact_phone as contact4_16_2_, customers0_.email as email16_2_, customers0_.memo as memo16_2_, customers0_.status as status16_2_, customers0_.first_name as first8_16_2_, customers0_.last_name as last9_16_2_, customers0_.lock as lock16_2_, customers0_1_.company_id as company2_17_2_, account1_.account_id as account1_0_0_, account1_.username as username0_0_, account1_.password as password0_0_, account1_.enabled as enabled0_0_, account1_.salt as salt0_0_, person2_.person_id as person1_16_1_, person2_.version as version16_1_, person2_.contact_phone as contact4_16_1_, person2_.email as email16_1_, person2_.memo as memo16_1_, person2_.status as status16_1_, person2_.first_name as first8_16_1_, person2_.last_name as last9_16_1_, person2_.lock as lock16_1_, person2_1_.company_id as company2_17_1_, person2_2_.birth as birth18_1_, person2_2_.phone_home as phone3_18_1_, person2_2_.phone_mobile as phone4_18_1_, person2_2_.ice_external as ice5_18_1_, person2_2_.ice_internal as ice6_18_1_, person2_2_.vacation_size_id as vacation7_18_1_, person2_.discriminator as discrimi2_16_1_ from person customers0_ inner join customer customers0_1_ on customers0_.person_id=customers0_1_.customer_id left outer join account account1_ on customers0_.person_id=account1_.account_id left outer join person person2_ on account1_.account_id=person2_.person_id left outer join customer person2_1_ on person2_.person_id=person2_1_.customer_id left outer join employee person2_2_ on person2_.person_id=person2_2_.employee_id where customers0_.company_id=?
ERROR: column customers0_.company_id does not exist
---
Produced SQL with joined-subclass strategy:
/* load one-to-many com.uwiss.hr.domain.Company.customers */ select customers0_.company_id as company2_3_, customers0_.customer_id as customer1_3_, customers0_.customer_id as person1_16_2_, customers0_1_.version as version16_2_, customers0_1_.contact_phone as contact3_16_2_, customers0_1_.email as email16_2_, customers0_1_.memo as memo16_2_, customers0_1_.status as status16_2_, customers0_1_.first_name as first7_16_2_, customers0_1_.last_name as last8_16_2_, customers0_1_.lock as lock16_2_, customers0_.company_id as company2_17_2_, account1_.account_id as account1_0_0_, account1_.username as username0_0_, account1_.password as password0_0_, account1_.enabled as enabled0_0_, account1_.salt as salt0_0_, person2_.person_id as person1_16_1_, person2_.version as version16_1_, person2_.contact_phone as contact3_16_1_, person2_.email as email16_1_, person2_.memo as memo16_1_, person2_.status as status16_1_, person2_.first_name as first7_16_1_, person2_.last_name as last8_16_1_, person2_.lock as lock16_1_, person2_1_.company_id as company2_17_1_, person2_2_.birth as birth18_1_, person2_2_.phone_home as phone3_18_1_, person2_2_.phone_mobile as phone4_18_1_, person2_2_.ice_external as ice5_18_1_, person2_2_.ice_internal as ice6_18_1_, person2_2_.vacation_size_id as vacation7_18_1_, case when person2_1_.customer_id is not null then 1 when person2_2_.employee_id is not null then 2 when person2_.person_id is not null then 0 end as clazz_1_ from customer customers0_ inner join person customers0_1_ on customers0_.customer_id=customers0_1_.person_id left outer join account account1_ on customers0_.customer_id=account1_.account_id left outer join person person2_ on account1_.account_id=person2_.person_id left outer join customer person2_1_ on person2_.person_id=person2_1_.customer_id left outer join employee person2_2_ on person2_.person_id=person2_2_.employee_id where customers0_.company_id=?
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months
[Hibernate-JIRA] Created: (HHH-2882) QueryKey.equals() returning false with distributed caching
by Daniel Campagnoli (JIRA)
QueryKey.equals() returning false with distributed caching
----------------------------------------------------------
Key: HHH-2882
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2882
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Reporter: Daniel Campagnoli
We noticed some issues recently with the query cache when using Coherence as the cache provider. This was due to instances of org.hibernate.cache.QueryKey not being equal after being serialized then deserialized.
The equals check was failing on the [ResultTransformer customTransformer] field which in our case had an instance of RootEntityResultTransformer (which comes from the field CriteriaSpecification.ROOT_ENTITY). This is because RootEntityResultTransformer doesnt override equals, so the check is done by reference equality. When the QueryKey has been serialized and deserialized out of the cache, the instance will always be different, so the equals check will fail.
A fix for this to be implement equals for RootEntityResultTransformer (and possibly the other ResultTransformer's). I used the following which worked fine.
public boolean equals(Object obj) {
return obj != null && this.getClass() == obj.getClass();
}
ps. I created HHH-1665 a while ago, a real simple fix, could that be looked at :)
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 11 months