Bug 952284 - Hibernate SchemaValidation on synonyms
Summary: Hibernate SchemaValidation on synonyms
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: TBD EAP 6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER1
: EAP 6.2.0
Assignee: Brett Meyer
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: eap62-upgrade-hibernate425
TreeView+ depends on / blocked
 
Reported: 2013-04-15 14:50 UTC by Adam Kovari
Modified: 2018-12-04 15:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
JBoss EAP 6 has been enhanced by providing the ability for Hibernate entities to be validated against table synonyms. Previously, the schema validation would only validate tables and views. To enable this new functionality, the `hibernate.synonyms=true` property must be set. For example, the following will now pass Hibernate schema validation: ---- "CREATE SYNONYM foo_synonym FOR foo_table" @Table(name = "foo_synonym") ----
Clone Of:
Environment:
Last Closed: 2013-12-15 16:12:56 UTC
Type: Enhancement
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JBPAPP-10707 0 Minor Resolved EAP 5.1.1 - One off patch for BZ-952284 - Hibernate SchemaValidation on synonyms 2017-07-25 22:39:35 UTC
Red Hat Issue Tracker JBPAPP-10709 0 Minor Closed Hibernate SchemaValidation on synonyms 2017-07-25 22:39:35 UTC

Description Adam Kovari 2013-04-15 14:50:21 UTC
Description of problem:
With "hibernate.hbm2ddl.auto=validate",

if there are synonyms on DB tables, the validation fails.
Sure, the schema validation could be disabled, but this validation gives a developer a better "security" feeling.

Upstream Jira/Patch:
https://hibernate.atlassian.net/browse/HHH-8183


Version-Release number of selected component (if applicable):
All up to EAP 6.1.0 Alpha


How reproducible:
Always

Steps to Reproduce:
1. use synonym on a table name
2. deploy an application with hbm2ddl = auto
  
Actual results:
Validation error.

Expected results:
Validation pass.

Additional info:
Pull requests:
* for master : https://github.com/hibernate/hibernate-orm/pull/508
* for 3.3 branch : https://github.com/hibernate/hibernate-orm/pull/510

Comment 1 Brett Meyer 2013-04-15 17:28:47 UTC
Adam, is this for a one-off, or just the permanent fix in 6.2.0?

Comment 2 JBoss JIRA Server 2013-04-15 19:19:01 UTC
Brett Meyer <brmeyer> made a comment on jira JBPAPP-10707

Attaching patched jar

Comment 3 JBoss JIRA Server 2013-04-15 19:34:50 UTC
Brad Maxwell <bmaxwell> made a comment on jira JBPAPP-10707

JBPAPP-10707-signed.tgz contains signed versions of the currently attached jars listed below.

hibernate-core-3.3.2.GA_CP05.jar:
 - MD5 checksum before signing: 272837e01dcdd58b236f8c6b68057cc3
 - MD5 checksum after signing: 8614eb219f0f73583d4f17a4a302861d

Comment 9 Adam Kovari 2013-04-16 06:57:49 UTC
This one is for the permanent fix.

Comment 12 JBoss JIRA Server 2013-04-16 16:24:05 UTC
Brett Meyer <brmeyer> updated the status of jira JBPAPP-10709 to Resolved

Comment 13 JBoss JIRA Server 2013-04-16 16:24:05 UTC
Brett Meyer <brmeyer> made a comment on jira JBPAPP-10709

Committed to http://svn.jboss.org/repos/hibernate/core/branches/Branch_3_3_2_GA_CP/

Comment 20 JBoss JIRA Server 2013-05-03 11:29:17 UTC
Adam Kovari <akovari> made a comment on jira JBPAPP-10709

This doesn't seem to work properly. The table validation succeeds - as it finds the table but it doesn't find any columns. For all columns it reports "Missing column":
{code}
Caused by: org.hibernate.HibernateException: Missing column: id in AKOVARI.TEST_SYN
	at org.hibernate.mapping.Table.validateColumns(Table.java:277)
	at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1131)
	at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
	at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:360)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1342)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:670)
	... 56 more
{code}

I'll attach a simple reproducer.

Comment 21 JBoss JIRA Server 2013-05-03 11:29:53 UTC
Adam Kovari <akovari> updated the status of jira JBPAPP-10709 to Reopened

Comment 22 JBoss JIRA Server 2013-05-03 11:29:53 UTC
Adam Kovari <akovari> made a comment on jira JBPAPP-10709

Reopening as the column validation seems not to work.

Comment 24 JBoss JIRA Server 2013-05-07 16:05:34 UTC
Brett Meyer <brmeyer> made a comment on jira JBPAPP-10709

Oracle requires that the "includeSynonyms" property be set to "true" in your datasource.  Following up with https://hibernate.atlassian.net/browse/HHH-8226.

Comment 26 JBoss JIRA Server 2013-05-07 20:29:14 UTC
Brett Meyer <brmeyer> made a comment on jira JBPAPP-10709

HHH-8226 committed to http://svn.jboss.org/repos/hibernate/core/branches/Branch_3_3_2_GA_CP/

Comment 27 JBoss JIRA Server 2013-05-07 20:29:25 UTC
Brett Meyer <brmeyer> updated the status of jira JBPAPP-10709 to Resolved

Comment 42 JBoss JIRA Server 2013-06-17 16:24:54 UTC
Christopher O'Brien <cobrien> updated the status of jira JBPAPP-10707 to Resolved

Comment 45 JBoss JIRA Server 2013-06-26 08:32:21 UTC
Adam Kovari <akovari> updated the status of jira JBPAPP-10707 to Resolved

Comment 47 Martin Simka 2013-09-23 13:16:43 UTC
verified on EAP 6.2.0.ER1

Comment 54 JBoss JIRA Server 2014-01-16 00:06:41 UTC
Scott Mumford <smumford> updated the status of jira JBPAPP-10709 to Reopened

Comment 55 JBoss JIRA Server 2014-01-16 00:07:55 UTC
Scott Mumford <smumford> updated the status of jira JBPAPP-10709 to Closed


Note You need to log in before you can comment on or make changes to this bug.