-
1. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
wolfgangknauf Sep 12, 2011 11:03 AM (in response to vitorrm)So, the error does not happen at deploy time, only at runtime when accessing the Entity bean? Is the table automatically created at deploy time, or does it already exist?
If it is happening at runtime: could you add this switch to your "persistence.xml" and check the sql statements found in the server log?
{code:xml}
<persistence-unit name="..."> <jta-data-source>...</jta-data-source> <properties> ... <!-- Activate SQL-Logging--> <property name="hibernate.show_sql" value="true"></property> </properties> </persistence-unit>
{code}
Best regards
Wolfgang
-
2. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
vitorrm Sep 12, 2011 1:06 PM (in response to wolfgangknauf)Hi
The table already exist in the SQL SERVER.
I enabled the log and the stack trace before the error is
13:47:04,605 INFO [org.hibernate.validator.engine.resolver.DefaultTraversableResolver] Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver. 13:47:04,609 INFO [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 13:47:04,613 INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{} 13:47:04,614 INFO [org.hibernate.connection.DatasourceConnectionProvider] Using datasource: java:jdbc/DATASOURCE_TESTE 13:47:04,617 INFO [org.hibernate.dialect.Dialect] Using dialect: org.hibernate.dialect.SQLServer2008Dialect 13:47:04,617 INFO [org.hibernate.cfg.SettingsFactory] Database -> name : Microsoft SQL Server version : 10.50.1617 major : 10 minor : 50 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Driver -> name : Microsoft JDBC Driver 4.0 for SQL Server version : 4.0.1427.2 major : 4 minor : 0 13:47:04,618 INFO [org.hibernate.transaction.TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions) 13:47:04,618 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Automatic flush during beforeCompletion(): disabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Automatic session close at end of transaction: disabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Scrollable result sets: enabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] JDBC3 getGeneratedKeys(): enabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Connection release mode: auto 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Default batch fetch size: 1 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Generate SQL with comments: disabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Order SQL updates by primary key: disabled 13:47:04,618 INFO [org.hibernate.cfg.SettingsFactory] Order SQL inserts for batching: disabled 13:47:04,619 INFO [org.hibernate.cfg.SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 13:47:04,619 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory 13:47:04,619 INFO [org.hibernate.cfg.SettingsFactory] Query language substitutions: {} 13:47:04,620 INFO [org.hibernate.cfg.SettingsFactory] JPA-QL strict compliance: enabled 13:47:04,620 INFO [org.hibernate.cfg.SettingsFactory] Second-level cache: enabled 13:47:04,620 INFO [org.hibernate.cfg.SettingsFactory] Query cache: disabled 13:47:04,620 INFO [org.hibernate.cfg.SettingsFactory] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Optimize cache for minimal puts: disabled 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Structured second-level cache entries: disabled 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Statistics: disabled 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Deleted entity synthetic identifier rollback: disabled 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Default entity-mode: pojo 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Named query checking : enabled 13:47:04,624 INFO [org.hibernate.cfg.SettingsFactory] Check Nullability in Core (should be disabled when Bean Validation is on): disabled 13:47:04,640 INFO [org.hibernate.impl.SessionFactoryImpl] building session factory 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType@15dd9c 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [clob] overrides previous : org.hibernate.type.ClobType@1883817 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType@1883817 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType@1aaa49 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType@a1c086 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType@166d107 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType@1253efb 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [blob] overrides previous : org.hibernate.type.BlobType@49f120 13:47:04,641 INFO [org.hibernate.type.BasicTypeRegistry] Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType@49f120 13:47:04,692 INFO [org.hibernate.impl.SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured 13:47:04,869 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 208, SQLState: S0002 13:47:04,869 ERROR [org.hibernate.util.JDBCExceptionReporter] Invalid object name 'teste_jboss'.
my persistence.xml looks like
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="testeUnit" transaction-type="RESOURCE_LOCAL"> <non-jta-data-source>java:jdbc/DATASOURCE_TESTE</non-jta-data-source> <class>com.empresa.Teste</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2008Dialect"/> <property name="hibernate.show_sql" value="true" /> </properties> </persistence-unit> </persistence>
tks for reply
-
3. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
wolfgangknauf Sep 12, 2011 4:33 PM (in response to vitorrm)Maybe it is a matter of SQLServer configuration - seems that it can be configured to use case sensitive table names: http://weblogs.sqlteam.com/mladenp/archive/2006/12/07/44176.aspx
Could you check this?
Best regards
Wolfgang
-
4. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
vitorrm Sep 12, 2011 5:00 PM (in response to wolfgangknauf)My database is using collation Latin1_General_BIN - Case Sensitive. Unfortunately, change the collation is not an alternative to me.
In the annotation @Table(name = "TESTE_JBOSS") I defined the table name in uppercase and this works in JbossAS 5.1 and JbossAS 6.0. Why don´t works in JbossAS 6.1?
If you note JPA/Hibernate is ignoring the uppercase of the annotation and trying to find the table with lowercase name.
Best regards
Vitor R Munhoz
-
5. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
wolfgangknauf Sep 13, 2011 9:57 AM (in response to vitorrm)Hi,
sorry, I don't know the Hibernate code good enough. I see that the SQL server dialects use case insensitive string comparisons: http://docs.jboss.org/hibernate/core/3.6/javadocs/org/hibernate/dialect/SQLServerDialect.html - there is a method "areStringComparisonsCaseInsensitive" which returns "true" always. But I don't know whether this is used also for table name case mapping.
You might try to find more help in hibernate forums: https://forum.hibernate.org/
Best regards
Wolfgang
-
6. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
vitorrm Sep 13, 2011 2:51 PM (in response to wolfgangknauf)I opened a discussion in Hibernate forum https://forum.hibernate.org/viewtopic.php?f=1&t=1012617
But I am using the same version of hibernate in Jboss 6.0 and Jboss 6.1 and on the 6.0 works. I wonder what has changed from one to another that causes this issue. I looked the changes in Jira but I didn't find anything relevant for my problem.
Wolfgang, Thks for trying help
Vitor
-
7. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
vitorrm Nov 21, 2011 8:45 AM (in response to vitorrm)Hi,
I ´ve not found the solution yet and I found the same behavior on JbossAS 7.0.x + JPA 2.0 + Hibernate 4.0.0.CR2.
How can I debug to know what´s going on?
Vitor
-
8. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
sajit Mar 8, 2012 11:40 PM (in response to vitorrm)I see same issues with JBoss 7.1.0 Final + Hibernate 4.0.1 too
-
9. Re: Jboss AS 6.1.0 + JPA + Hibernate - Case Sensitive problem
vitorrm Mar 9, 2012 7:28 AM (in response to sajit)Good morning,
It seems to be a hibernate problem.
I´ve solved the problem changing the hibernate version in Jboss 6.1 to version 3.6.7 and I removed the version that was there before.