[Hibernate-JIRA] Created: (HHH-4553) Hibernate doesn't support official JPA2 escape char for table name
by Julien HENRY (JIRA)
Hibernate doesn't support official JPA2 escape char for table name
------------------------------------------------------------------
Key: HHH-4553
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4553
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.0-Beta-2
Environment: Oracle 9i
Derby
Reporter: Julien HENRY
One of the table of my schema is named FUNCTION. As it is a reserved name with Derby (used for my JUnit tests), I have escaped the table name to make it works with Derby (as specified by JPA2 spec $2.13):
@Entity
@Table(name="\"FUNCTION\"")
public class Function {
//...
}
My JUnit tests are working fine, then I tried to connect to my Oracle DB, and I have enabled schema validation:
<property name="hibernate.hbm2ddl.auto" value="validate"/>
But I got an exception as Hibernate is looking for a table with name "FUNCTION" in Oracle metadata.
Caused by: org.hibernate.HibernateException: Missing table: "FUNCTION"
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1153) [hibernate-core-3.5.0-Beta-2.jar:3.5.0-Beta-2]
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139) [hibernate-core-3.5.0-Beta-2.jar:3.5.0-Beta-2]
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:364) [hibernate-core-3.5.0-Beta-2.jar:3.5.0-Beta-2]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1367) [hibernate-core-3.5.0-Beta-2.jar:3.5.0-Beta-2]
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:858) [hibernate-annotations-3.5.0-Beta-2.jar:3.5.0-Beta-2]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:733) [hibernate-entitymanager-3.5.0-Beta-2.jar:3.5.0-Beta-2]
This is not specific to Oracle, because when I change:
<property name="hibernate.hbm2ddl.auto" value="create"/>
by
<property name="hibernate.hbm2ddl.auto" value="validate"/>
in my JUnit tests, I have the same issue with the embedded Derby DB.
Using Hibernate specific ` as quote works fine:
@Entity
@Table(name="`FUNCTION`")
public class Function {
//...
}
The issue can be easily fixed in Table.setName(String name). Replace:
if ( name.charAt( 0 ) == '`' ) {
by
if ( name.charAt( 0 ) == '"' ) {
or if you want to keep backward compatibility:
if ( name.charAt( 0 ) == '`' || name.charAt( 0 ) == '"' ) {
--
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, 4 months
[Hibernate-JIRA] Created: (HHH-3271) Prepare Statement Caching
by lalit railwani (JIRA)
Prepare Statement Caching
-------------------------
Key: HHH-3271
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3271
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: Hibernate 3.2.5, Oracle 10g
Reporter: lalit railwani
We are using Hibernate 3.2.5 are trying to evaluate hibernate batching vis a vis JDBC batching.
As per our results the hibernate batching takes approx 2 times the time taken by JDBC batching.
The problem is we need to commit the batches also so in a loop we are commiting the transaction also (batching).
But for every new loop hibernate creates new prepared statements i.e. if we have 20 batches 20 prepared statements per table/entity are being created but in case of JDBC the same can be done using 1 prepared statement per table/entity.
Hibernate does reuse the prepared statements within a batch but not across batches. If hibernate can reuse these statements it would significantly reduce the timings and would bring the hibernate batching close to jdbc batching.
This is happening even after enabling prepare statement caching in the hibernate cfg xml.
--
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, 4 months
[Hibernate-JIRA] Created: (HV-266) NullPointerException when trying to validate an object with a class-level constraint annotation.
by Marcus Brito (JIRA)
NullPointerException when trying to validate an object with a class-level constraint annotation.
------------------------------------------------------------------------------------------------
Key: HV-266
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-266
Project: Hibernate Validator
Issue Type: Bug
Affects Versions: 4.0.1
Reporter: Marcus Brito
The JPATraversableResolver seems to fumble when passed a property path of "" (constraint on root bean class):
{code}
java.lang.NullPointerException
at java.lang.Class.searchFields(Class.java:2599)
at java.lang.Class.getField0(Class.java:2618)
at java.lang.Class.getField(Class.java:1518)
at org.hibernate.ejb.util.PersistenceUtilHelper.get(PersistenceUtilHelper.java:84)
at org.hibernate.ejb.util.PersistenceUtilHelper.isLoadedWithReference(PersistenceUtilHelper.java:76)
at org.hibernate.ejb.HibernatePersistence.isLoadedWithReference(HibernatePersistence.java:178)
at javax.persistence.Persistence$1.isLoaded(Persistence.java:81)
at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:33)
at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:112)
at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:764)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:331)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
{code}
--
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, 4 months
[Hibernate-JIRA] Created: (HHH-3578) Add setReadOnly(true) method to the Criteria interface
by Graeme Rocher (JIRA)
Add setReadOnly(true) method to the Criteria interface
------------------------------------------------------
Key: HHH-3578
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3578
Project: Hibernate Core
Issue Type: New Feature
Components: core
Affects Versions: 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1, 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1, 3.1.3, 3.2.0.alpha2, 3.2.0.alpha1, 3.1.2, 3.1.1, 3.1, 3.1 rc3, 3.1 rc2, 3.1 rc 1, 3.1 beta 2, 3.1 beta 1, 3.0.5, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0 final, 3.0 rc 1, 3.0 beta 4, 3.0 beta 3, 3.0 beta 2, 3.0 beta 1, 3.0 alpha
Reporter: Graeme Rocher
Currently the Query interface has a setReadOnly(true) method but the Criteria interface does not, this makes it impractical to use the Criteria API for read-only queries.
--
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, 4 months
[Hibernate-JIRA] Created: (HHH-3772) Constraint names cannot be quoted with backticks `
by Christian (JIRA)
Constraint names cannot be quoted with backticks `
--------------------------------------------------
Key: HHH-3772
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3772
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3, all database dialects
Reporter: Christian
Priority: Minor
Table and Column names can be quoted with ` but constraint names cannot be quoted. You can reproduces the bug with the following testcase:
@javax.persistence.Entity
@javax.persistence.Table( name = "`categories`" )
abstract public class Category {
...
@org.hibernate.annotations.ForeignKey( name = "`fk_categories_parent_id`" )
@javax.persistence.ManyToOne( targetEntity = Category.class )
@javax.persistence.JoinColumn( name = "`parent_id`" )
private Category parent;
...
}
The SchemaExport (hbm2ddl) creates the following SQL statement for Postgresql:
alter table "categories" drop constraint `fk_categories_parent_id`;
drop table "categories";
create table "categories" (
...
"parent_id" int8,
...
);
alter table "categories" add constraint `fk_categories_parent_id`
foreign key ("parent_id") references "categories";
I think this problem should be fixed in the method in the class org.hibernate.mapping.Constraint in the same way as in Table.java and Column.java:
old:
public void setName(String name) {
this.name = name;
}
new:
private boolean quoted = false;
public void setName(String name) {
if ( name.charAt( 0 ) == '`' ) {
quoted = true;
this.name = name.substring( 1, name.length() - 1 );
}
else {
this.name = name;
}
}
public String getQuotedName() .. same as in Column.java
public String getQuotedName(Dialect d) { .. same as in Column.java
public boolean isQuoted() .. same as in Column.java
public String sqlDropString( ... ) {
...
return "alter table " + getTable().getQualifiedName( dialect, defaultCatalog, defaultSchema ) + " drop constraint " + getQualifiedName();
...
}
public String sqlCreateString( ... ) {
...
String constraintString = sqlConstraintString( dialect, getQualifiedName(), defaultCatalog, defaultSchema );
...
}
--
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, 4 months
[Hibernate-JIRA] Created: (HHH-4070) createProxy() called even when hasProxy() returns false
by Philip Borlin (JIRA)
createProxy() called even when hasProxy() returns false
-------------------------------------------------------
Key: HHH-4070
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4070
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: 3.3.2GA, PostgresQL 8.3
Reporter: Philip Borlin
This problem occurs when an EntityTuplizer is used. In my case I throw an UnsupportedOperationException in my createProxy() method. I would expect that would be ok since my hasProxy() method returns false. This was working in 3.3.1 but broke in 3.3.2.
In DefaultLoadEventListener in the proxyOrLoad() method there is a call to persister.hasProxy(). This makes a call to AbstractEntityPersister which simply checks to see whether the entityMetamodel isLazy().
That check succeeds since lazy is sent to true.
The next check sees if isAllowProxyCreation() is false in the options.
Lastly creatProxyIfNecessary() is called which if the entity does not exist calls createProxy() on the persister. AnstractEntityPersister delegates this directly to the tuplizer.
At no point was the tuplizer's hasProxy() method ever consulted.
--
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, 4 months
[Hibernate-JIRA] Created: (HBX-936) Project cannot be deleted when there is console configuration associated with the project
by Dariusz Tylus (JIRA)
Project cannot be deleted when there is console configuration associated with the project
-----------------------------------------------------------------------------------------
Key: HBX-936
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-936
Project: Hibernate Tools
Issue Type: Bug
Components: consoleconfiguration, eclipse
Affects Versions: 3.2beta9
Environment: Eclipse 3.2, Windows XP, jdk1.5.0_8
Reporter: Dariusz Tylus
Project cannot be deleted when there is console configuration associated with the project:
Use case:
1. Create java project
2. Put jdbc driver jar file into lib filder (in the project)
3. Create console configuration for this project
4. Swich to the hibernate perspective and expand the tree for just created console configuration
5. Delete the console configuration
6. Delete the project and select option 'Also delete contents under....'
There is following error:
==
Problems encountered while deleting resources.
Could not delete: /hbmtest.
Problems encountered while deleting resources.
Problems encountered while deleting files.
Could not delete: C:\work\ORM\_tests\orm\hbmtest\lib\hsqldb-1_7_2_9.jar.
Could not delete: C:\work\ORM\_tests\orm\hbmtest\lib.
==
The problem is that jvm keeps lock on the jar file so it cannot be deleted.
Console configuration also keeps reference to the driver class.
Could the console configuration release all resources when it is deleted?
Thenx,
Dariusz
--
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, 4 months
[Hibernate-JIRA] Created: (HHH-4587) Criteria.createAlias : QueryException on @Embedded attributes
by Marcos Antonio de Vasconcelos Junior (JIRA)
Criteria.createAlias : QueryException on @Embedded attributes
-------------------------------------------------------------
Key: HHH-4587
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4587
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core, query-criteria
Affects Versions: 3.3.0.GA
Environment: Hibernate 3.3.0
MySql 5.1.29
Reporter: Marcos Antonio de Vasconcelos Junior
Priority: Blocker
Hi, recently i discover my app always throws a Exception when searching with alias in @Embedded fields.
The model look like this.
[code]
@Embeddable
public class Contato {
//attrs
}
@Table
@Entity(name = "motorista")
public class Motorista {
@Embedded
private Contato contato;
//+attrs
}
[/code]
And the following code:
[code]
Session s = HibernateUtil.openSession();
Criteria crit = s.createCriteria(Motorista.class);
crit.createAlias("contato", "contato");
crit.add(Restrictions.like("contato.nome", "jo",
MatchMode.ANYWHERE));
System.out.println(crit.list().size());
[/code]
Always throws QueryException and the StackTrace:
[code]
Exception in thread "main" org.hibernate.QueryException: could not resolve property: nome of: br.com.sistram.model.prestador.Motorista
at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1379)
at org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:31)
at org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1354)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumns(CriteriaQueryTranslator.java:434)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getColumnsUsingProjection(CriteriaQueryTranslator.java:394)
at org.hibernate.criterion.SimpleExpression.toSqlString(SimpleExpression.java:45)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:334)
at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:90)
at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:59)
at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:67)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1550)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at br.com.sistram.util.DaoListPaginator.main(DaoListPaginator.java:160)
[/code]
When looking for a solution i discover this problem don't occurs when I use the @OneToMany + @JoinColumn annotations instead of @Embedded.
No one in hibernate forums and in a brazilian forum I'm member can't help, so I think it's a bug.
--
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, 4 months