[Hibernate-JIRA] Created: (HHH-5449) Versioned HQL update might issue incorrect SQL
by Stian Brattland (JIRA)
Versioned HQL update might issue incorrect SQL
----------------------------------------------
Key: HHH-5449
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5449
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.4
Environment: Hibernate 3.5.4 and MySQL.
Reporter: Stian Brattland
Priority: Minor
When executing a versioned HQL update, the version column (java.util.Calendar) is updated using 'updated=updated+1'. Some MySQL versions will throw an exception whenever the incremented value ended with 59. For instance, if the previous version value was '2010-03-12 13:00:59', then MySQL will throw an exception as the incremented value would be '2010-03-12 13:00:60' (see http://dev.mysql.com/doc/refman/5.0/en/time-zone-leap-seconds.html for more on this).
In this case, Hibernate would throw the exception 'SEVERE: Data truncation: Incorrect datetime value: '20100302130060.000000' for column 'updated' at row 1'.
I've received feedback on this issue through the Hibernate forum which indicates that this might be a bug (https://forum.hibernate.org/viewtopic.php?f=1&t=1006238)
** Entity.hbm.xml **
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.tracker.robot.db.entities.Entity" table="track">
<id column="id" length="36" name="id" type="java.lang.String" />
<version column="updated" name="updated" type="java.util.Calendar" unsaved-value="null" />
<property column="title" length="255" name="title" type="java.lang.String"/>
</class>
</hibernate-mapping>
** Entity.java **
import java.util.Calendar;
public class Entity {
private String id;
private String title;
private Calendar updated;
public Entity() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Calendar getUpdated() {
return updated;
}
public void setUpdated(Calendar updated) {
this.updated = updated;
}
}
** TestCode **
currentSession.beginTransaction();
Query q = currentSession.createQuery("update versioned Entity e set e.title = :title where e.id = :id");
q.setString("title", "TEST");
q.setString("id", "000059e4-8b71-41c1-81f2-5cacabba5554");
q.executeUpdate();
currentSession.getTransaction().rollback();
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-5475) allow for a usertype delegate for org.hibernate.type.EnumType
by Jürgen (JIRA)
allow for a usertype delegate for org.hibernate.type.EnumType
-------------------------------------------------------------
Key: HHH-5475
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5475
Project: Hibernate Core
Issue Type: New Feature
Components: annotations, core
Affects Versions: 3.5.4, 3.3.1
Reporter: Jürgen
Attachments: EnumType.java
I use a custom UserType to right-trim CHAR columns in a legacy DB2, which returns CHAR columns right space padded.
Now I would like map such a column to a Enum, which fails using @Enumerated (org.hibernate.type.EnumType) due to the fact that DB column values with right pad spaces do not match enum names.
I would like to request the a EnumType that allows to inject/delegate to a UserType.
(db column + UserType = java object toString()-able or Numeric) + EnumType = Enum
Of course one could always define a UserType doing triming + enum conversion but would be nice to make it pluggable
I added a workaround delegated EnumType that uses some dirty stuff to handle the described process, including reflection and implementing stubs for ResultSet + PreparedStatement (thats why the Class is so huge, the real logic is quite small)
--
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
14 years, 4 months
[Hibernate-JIRA] Commented: (HHH-1643) Sub-query as function parameter - either sub-query is missed from SQL or NullPointerException raised
by Manuel Dominguez Sarmiento (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643?page=c... ]
Manuel Dominguez Sarmiento commented on HHH-1643:
-------------------------------------------------
Any chance of getting this patch into the Hibernate trunk? We've been patching Hibernate for almost a year and a half already because of this simple one-line fix. We've been running HQL queries in production that require this patch ever since then, without any troubles.
Again, this is not laziness, but patching this part of Hibernate requires a carefully setup environment, since it involves ANTLR-generated bytecode, a full Maven build has to be performed (which not always works out of the box, there are several show-stoppers which we've worked around to get this process internally streamlined each time a new Hibernate release comes out). If it were any other part of the library, we could simply swap .class files inside of the JAR (ugly, but it works), but this is simply not the case here.
> Sub-query as function parameter - either sub-query is missed from SQL or NullPointerException raised
> ----------------------------------------------------------------------------------------------------
>
> Key: HHH-1643
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.2, 3.1.3
> Environment: Hibernate 3.1.2 MS SQL Server 2K
> Reporter: Andy Shelton
> Attachments: hql-sql.patch
>
>
> The HQL grammar HQL (hql.g) allows expressions and sub-queries as parameters to functions, however the SQL Tree Transform grammar (hql-sql.g) does not, it only allows expressions. This means if you pass a sub-query as a parameter to something like "cast" for example, you will get a NullPointerException. In other cases, typically the sub-query is missed out of the resulting SQL. This is easily remedied by changing the first line of the definition of functionCall within hql-sql.g from:
> functionCall
> : #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (expr)* ) )? )
> to:
> functionCall
> : #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (exprOrSubquery)* ) )? )
> This modification has been tested against all the existing UnitTests in Hibernate 3.1.2 and does not cause any problems.
> I've included a patch for this.
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-3191) QueryPlanCache cache size
by Julien Kirch (JIRA)
QueryPlanCache cache size
-------------------------
Key: HHH-3191
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3191
Project: Hibernate3
Issue Type: Improvement
Components: query-hql
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6, all platform
Reporter: Julien Kirch
On a large application with many (currently 696) named queries in hbm files we have a performance issue with the QueryPlanCache cache size:
The SoftLimitMRUCache used in the QueryPlanCache use 128 hard references, the other being soft references, and this number is hardcoded.
As we have much more querries in the application, we spend much time in recompiling the same queries when they are evicted from the cache.
As the QueryPlanCache has a SessionFactoryImplementor as parameter, adding a new parameter to define the query cache plan size would be trivial; what's your opinion about this ?
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-4627) Configurable Query Plan Cache
by Frank Daspro (JIRA)
Configurable Query Plan Cache
-----------------------------
Key: HHH-4627
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4627
Project: Hibernate Core
Issue Type: New Feature
Components: query-hql
Affects Versions: 3.2.2
Environment: Hibernate 3.22 GA, Oracle 10G database
Reporter: Frank Daspro
Our application heavily uses dynamic sql some of which are highly parameterised and with many permutations. Out of neccessity we also have a very large JVM heap space (12GB). As a result we end up with a very large memory utilisation for the Query Plan cache. From a recent memory dump it was noted the QueryPlanCache had 25000 entries and consuming 2.5GB of heap space. Our full Garbage collections end up taking longer than it would normally take with a smaller QueryPlanCache.
I understand via a related issue (http://opensource.atlassian.com/projects/hibernate/browse/HHH-3191) there is a hard limit of 128 entries, and an endless soft limit which is only garbage collected during a full garbage collection. It would be nice if the following features could be added:
1) Configuration options to specify the hard and soft limits (with a 0 to disable or similar).
2) Configurable at the query level such that specific queries can be excluded from the the QueryPlanCache. eg. something like hibernateQuery.setParsedHQLCacheable(false).
--
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
14 years, 4 months