[Hibernate-JIRA] Created: (HHH-1994) Problem with case sensitive column and tables names and Identity mapping with postgreSQL
by Alex Samad (JIRA)
Problem with case sensitive column and tables names and Identity mapping with postgreSQL
----------------------------------------------------------------------------------------
Key: HHH-1994
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1994
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: Hibernate 3.1.3, Java 1.5.0_07 (sun) windos and linux ( 32 & 64 bit). POstgres SQL 8.1 Windows and linux
Reporter: Alex Samad
Whilst trying to insert into a table with a primary key (ID mapping) which has a identity generator. And the columns and/or the table has been defined with case sensitivey ie back ticks.
It fails to get the next serial number and thus fails any inserts.
The problem lies in dialect/PostgreSQLDialect.java
public String getIdentitySelectString(String table, String column, int type) {
return new StringBuffer().append("select currval('")
.append(table)
.append('_')
.append(column)
.append("_seq')")
.toString();
}
table is inclosed in quotes and column is inclosed in quotes which gives a name like
"table"_"Column"_seq - which fails
I would suggest a fix is to test each of table or column for " and if it exist then to strip it of both of table and column and encluse the whole name in "". This mighe break some old code where say the table is coded in case insensitive table name and case sensitive column key.
Sorry not much of a java programmer.
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-5025) Support caching audit queries using ehcache's DiskStore.
by Brent Worden (JIRA)
Support caching audit queries using ehcache's DiskStore.
--------------------------------------------------------
Key: HHH-5025
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5025
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Reporter: Brent Worden
Priority: Minor
Enabling audit query caching with a ehcache cache configured as persisting to disk or overflowing to disk. For example,
<defaultCache diskPersistent="true" eternal="false" maxElementsInMemory="1000" maxElementsOnDisk="10000" overflowToDisk="true" timeToIdleSeconds="300" timeToLiveSeconds="3600" />
Results in the following exception:
java.io.NotSerializableException: org.hibernate.envers.entities.RevisionTypeType
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
The lack of needed serialization prohibits the use of ehcache's DiskStore.
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-3325) Pagination with Oracle ROWNUM is sub-optimal
by e. wernli (JIRA)
Pagination with Oracle ROWNUM is sub-optimal
--------------------------------------------
Key: HHH-3325
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3325
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Reporter: e. wernli
Pagination with Oracle ROWNUM is sub-optimal
The feature works but result in sub-optimal SQL. The generated SQL is the following:
select * from ( select row_.*, rownum rownum_ from ( select this_.id as id3_0_, this_.version as version3_0_, this_.name as name3_0_, this_.type as type3_0_, this_.marketstatus as marketst5_3_0_ from Customer this_ order by this_.id asc ) row_ ) where rownum_ <= ? and rownum_ > ?
But this SQL is faster:
SELECT *
FROM (SELECT row_.*, ROWNUM rownum_
FROM (SELECT this_.ID AS id3_0_, this_.VERSION AS version3_0_,
this_.NAME AS name3_0_, this_.TYPE AS type3_0_,
this_.marketstatus AS marketst5_3_0_
FROM customer this_
ORDER BY this_.ID ASC) row_
WHERE ROWNUM <= ?)
WHERE rownum_ > ?
The second solution allows Oracle to use an optimization that can dramatically reduce the time of the query, especially one of the first page is retrieved.
See this link for an explanation of this optimization: http://decipherinfosys.wordpress.com/2007/08/09/paging-and-countstopkey-o...
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-4956) Native Query returns wrong results
by Akashdeep Saddi (JIRA)
Native Query returns wrong results
----------------------------------
Key: HHH-4956
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4956
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.3.2
Environment: hibernate 3.3.2.GA , linux, oracle 10g, weblogic 10
Reporter: Akashdeep Saddi
Issue: In-case running native queries vai hibernate we have two technical ID's in the select clause from join of two or more tables the value of all the id's is set to one value.
Example
A.id = 1
B.id =2
select A.Id as A_ID, B.Id as B_ID from A, B where A.B_id = B.id will return 1,1 in the result instead of 1,2
Resolution: Use Alias in-case more than one technical keys are part of select clause. Above query works fine when changed as below
select A.Id , B.Id from A, B where A.B_id = B.id will return 1,2
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-5654) query.setLockMode("alias", LockMode.LockMode.PESSIMISTIC_WRITE); does not Lock in PostgreSqlDialect
by Peter Buning (JIRA)
query.setLockMode("alias", LockMode.LockMode.PESSIMISTIC_WRITE); does not Lock in PostgreSqlDialect
---------------------------------------------------------------------------------------------------
Key: HHH-5654
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5654
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.5
Environment: Hibernate 3.5.5-Final
PostgreSQL 8.4
Reporter: Peter Buning
When you call
{{query.setLockMode("alias", LockMode.PESSIMISTIC_WRITE);}}
you get a Query with a LockOptions object that has lockMode = LockMode.NONE and a aliasSpecificLockModes-map with an entry "alias" -> LockMode.PESSIMISTIC_WRITE
When calling {{query.list()}} you get to the QueryLoader which calls {{dialect.applyLocksToSql(...)}}
The LockOptions-Object has still lockMode=LockMode.NONE and a aliasSpecificLockModes-map with the translated alias and -> LockMode.PESSIMISTIC_WRITE
As we use PostgreSQL dialect is an instance of PostgreSQLDialect.
So you get a ForUpdateFragement-object with the same LockOptions-object. The aliases-String contains the translated "alias".
In {{toFragmentString()}} {{getForUpdateString(String aliases, LockOptions lockOptions)}} is called because we have a LockOptions-object. The aliases are ignored in this case, as you can see in the comment:'by default we simply return the getForUpdateString() result since the default is to say no support for "FOR UPDATE OF ..."'
But the {{getForUpdateString(LockOptions lockOptions)}} is only looking at the the lockMode-Attribute of the LockOptions-object what has still the value "LockMode.NONE". It results in an empty String as the return value. But it should be " for update" because there's a LockMode.PESSIMISTIC_WRITE in the aliasSpecificLockModes which is ignored in getForUpdateString(LockOptions lockOptions)
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (JPA-7) JPA Support of Enum as Primary Key
by Bernard (JIRA)
JPA Support of Enum as Primary Key
----------------------------------
Key: JPA-7
URL: http://opensource.atlassian.com/projects/hibernate/browse/JPA-7
Project: Java Persistence API
Issue Type: Improvement
Affects Versions: 1.0.1
Environment: java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)
Hibernate JPA as installed with latest NetBeans release 6.9.1
Reporter: Bernard
Priority: Critical
Attachments: TestCase.zip
Enums work as primary keys in TopLink and EclipseLink.
DataNucleus supports them, too:
http://www.datanucleus.org/products/accessplatform/jpa/primary_key.html
In the attached testcase, JPA, via persistence.xml, creates a database column type of
VARBINARY. The data contained in it is like:
10101100111011010000000000000101~r0000000000011000main.MyEntity$EntityType0000000000000000000000000000000000000000000000000000000000000000000100100000000000000000xr0000000000001110java.lang.Enum0000000000000000000000000000000000000000000000000000000000000000000100100000000000000000xpt0000000000000110TYPE_1 Type 1
That is not what we need.
We need an integer because in the entity class, we specify
@Enumerated(value = EnumType.ORDINAL)
While Enum as ID field is not specifically supported in the JPA specs, it is not specifically excluded, either.
It would be desirable to have the new version of the spec include this feature, too.
The attached testcase (zip file) runs with NetBeans out of the box.
--
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
13 years, 5 months
[Hibernate-JIRA] Created: (HHH-4613) HQL: QuerySyntaxException when parsing any condition containing a colum named "value"
by Guenther Demetz (JIRA)
HQL: QuerySyntaxException when parsing any condition containing a colum named "value"
-------------------------------------------------------------------------------------
Key: HHH-4613
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4613
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-2
Environment: 3.5.0-Beta2, Db: HSQLDB
Reporter: Guenther Demetz
Priority: Minor
Attachments: TestCaseQueryWithCondition.jar
org.hibernate.hql.ast.QuerySyntaxException: expecting OPEN, found '=' near line 1, column 27
is thrown calling
((org.hibernate.Session) session).createQuery("from hello.A where value = ?");
Please note that until Hibernate3.3.2GA this worked fine!
Apparently 'value' unintentionally has become a reserved keyword for HQL conditions.
Here the complete stacktrace:
--> org.hibernate.hql.ast.QuerySyntaxException: expecting OPEN, found '=' near line 1, column 27 [from hello.A where value = ?]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:284)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1586)
at hello.TestQueryWithCondition.testQuery(TestQueryWithCondition.java:40)
Please consider attached junit-testcase.
best regards
Guenther Demetz
--
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
13 years, 5 months