[Hibernate-JIRA] Created: (HHH-5566) Clob column are not getting updated, even if there is real updated in the Clob data, when we do merge operation
by Srinivasa Rao Yedluri (JIRA)
Clob column are not getting updated, even if there is real updated in the Clob data, when we do merge operation
---------------------------------------------------------------------------------------------------------------
Key: HHH-5566
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5566
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: Spring2.5.6, Hibernate3.3.2, Weblogic10.3.1, Red Hat Linux, Oracle10G
Reporter: Srinivasa Rao Yedluri
Below is the hbm file snippet
<hibernate-mapping>
<class name="......OrderLineDTO"
table="ORDER_LINES" dynamic-update="true">
<id name="lineId" type="long" column="LINE_ID" length="15">
<generator class="sequence">
<param name="sequence">xyz</param>
</generator>
</id>
..................................
..................................
..................
<property name="installationDetailClob" type="clob" column="ORDER_LINE_ATTRIBUTES_MAP"
not-null="false" lazy="true" />
<property name="attathmentMetadataClob" type="clob" column="ORDER_ATTACHMENT_METADATA"
not-null="false" lazy="true"/>
<!-- Associations -->
<!-- bi-directional many-to-one association to OrderHeader -->
<many-to-one name="orderHeader"
class="......"
fetch="select">
<column name="HEADER_ID" not-null="true" length="15" />
</many-to-one>
<!--
bi-directional many-to-one association to SmartHand
-->
<set name="smartHands" inverse="true" lazy="false"
cascade="all,delete-orphan">
<key>
<column name="LINE_ID" /><!-- a foreign key in SMART_HANDS referencing the primary key of this table.
-->
</key>
<one-to-many
class="...................SmartHandDTO" />
</set>
</class>
</hibernate-mapping>
DAO Code snippet:
public void update(OrderHeaderDTO orderHeaderDTO)
throws DataAccessException {
getOrdersHibernateTemplate().merge(orderHeaderDTO);
}
1. Create a table with clob column and have some other columns. Have one column with timestamp.
2. Insert a record in to it.
3. Now create detached object with new operator and populate all the information programatically including pk. Populate clob column and timestamp with different data than already persisted data.
3. Now do merg operation on this object, we find only timestamp column is part of update query but not clob column.
Please let me know if you need any more details.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HV-376) validateValue() and validateProperty() are too restrictive regarding processable property names
by Gunnar Morling (JIRA)
validateValue() and validateProperty() are too restrictive regarding processable property names
-----------------------------------------------------------------------------------------------
Key: HV-376
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-376
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Reporter: Gunnar Morling
Assignee: Hardy Ferentschik
Priority: Minor
The methods Validator#validateValue() and Validator#validateProperty() expect the name of a bean property, for which constraint validation should be performed.
Currently not all valid Java property (field/method) identifiers are supported here, as the specified property name is processed in PathImpl with a regular expression, that matches only the word character class (A-Za-z0-9_), causing the evaluation of uncommon but yet valid property names such as the following ones to fail:
* private String höchstBetrag; // German Umlaute such as "ö" are allowed in Java identifiers
* private String €Amount; // some currency signs such as "€" are allowed, sigh
* private String höchst\u00f6Betrag; // specifying letters such as "ö" using Unicode is allowed
Trying to do so results in the following exception:
{code:java}
java.lang.IllegalArgumentException: Unable to parse property path ö
at org.hibernate.validator.engine.PathImpl.parseProperty(PathImpl.java:216)
at org.hibernate.validator.engine.PathImpl.createPathFromString(PathImpl.java:64)
at org.hibernate.validator.engine.ValidatorImpl.validateValue(ValidatorImpl.java:152)
{code}
More information on the identifiers allowed in the Java language can be found in [JLS, chapter 3.8|http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.8].
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-5057) ScrollableResults does not fetch many-to-many collections
by Jérôme Van Der Linden (JIRA)
ScrollableResults does not fetch many-to-many collections
---------------------------------------------------------
Key: HHH-5057
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5057
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Reporter: Jérôme Van Der Linden
Priority: Blocker
I have a many-to-many relation between two objects :
{code:title=Project.java|borderStyle=solid}
@Entity
public class Project {
private List<Viperson> managers;
@ManyToMany(targetEntity = Viperson.class)
@JoinTable(name = "PRJMANAGER", joinColumns = @JoinColumn(name = "PROJECTID", nullable = false), inverseJoinColumns = @JoinColumn(name = "VIPID", nullable = false))
public List<Viperson> getManagers() {
return managers;
}
}
{code}
{code:title=Viperson.java|borderStyle=solid}
@Entity
public class Viperson {
private List<Project> projects;
@ManyToMany(mappedBy = "managers", targetEntity = Project.class)
public List<Project> getProjects() {
return projects;
}
}
{code}
And the following test (actually, it is a code from spring batch HibernateCursorItemReader I put in a testcase) :
{code}
@Test
public void testSelectAll() {
StatelessSession statelessSession = sessionFactory.openStatelessSession();
ScrollableResults cursor = statelessSession.createQuery("from Project").scroll();
Object[] data = null;
if (cursor.next()) {
data = cursor.get();
}
}
{code}
data contains a {{Project}} but {{managers}} field is *null*, +even if I add eager fetching+. I have also a {{OneToMany}} in the {{Project}} class. This one is well loaded (i have a {{PersistentBag}}).
Is there anything I miss ? I suspect a bug on that.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (ANN-843) Version increment not triggered on @OneToOne property modification having inverse owner
by Guenther Demetz (JIRA)
Version increment not triggered on @OneToOne property modification having inverse owner
---------------------------------------------------------------------------------------
Key: ANN-843
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-843
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Hibernate 3.3.1.GA , Microsoft SQL Server
Reporter: Guenther Demetz
Priority: Minor
Attachments: Testcase.jar
In the revised "Java Persistence with Hibernate" book by Christian Bauer and Gavin King on page 464
there's written following about versioning:
"If you use Hibernate as JPA provider ... every value-typed property modification .. triggers a version increment."
Now I saw that Version increment indeed is not triggered on @OneToOne properties having an inverse owner (= mappedBy setted).
This allows several concurrent transactions to set the association from same object towards different targets without having a OptimistickLockException at commit.
This violates the ToOne policy! (Hibernate detects the inconsistency later when loading the property from database:
org.hibernate.HibernateException: More than one row with the given identifier was found)
Please see attached junit-testcase for reproducing the problem.
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-5163) ClassCastException when Hibernate tries to cache results using ResultTransformer
by Strong Liu (JIRA)
ClassCastException when Hibernate tries to cache results using ResultTransformer
--------------------------------------------------------------------------------
Key: HHH-5163
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5163
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Reporter: Strong Liu
Assignee: Gail Badner
Fix For: 3.5.x, 3.6
When Hibernate executes a cacheable query using a ResultTransformer, it will attempt to cache the results AFTER applying the ResultTransformer. The problem is that the ResultTransformer may modify the data in a way that Hibernate won't understand it anymore, and in this case it will generate a ClassCastException when trying to cache it.
---------------------------
this can be reproduced by CriteriaQueryTest with following change:
papa-pc:testsuite stliu$ svn diff src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
Index: src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java
===================================================================
--- src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java (revision 19246)
+++ src/test/java/org/hibernate/test/criteria/CriteriaQueryTest.java (working copy)
@@ -613,6 +613,7 @@
)
.addOrder( Order.desc("studentName") )
.setResultTransformer( Transformers.aliasToBean(StudentDTO.class) )
+ .setCacheable( true )
.list();
assertEquals(2, resultWithAliasedBean.size());
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-3872) Criteria on alias causes partial collection materialization
by Adrian Moos (JIRA)
Criteria on alias causes partial collection materialization
-----------------------------------------------------------
Key: HHH-3872
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3872
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.3.0.CR1
Reporter: Adrian Moos
I have a parent entity with a one-to-many assocation to a child entity:
<hibernate-mapping package="ch.bedag.a11.ccinfo.business.entity" default-lazy="false">
<class name="Parent" table="PARENT">
<id name="id" type="long" column="ID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">SEQ_T_PARENT</param>
</generator>
</id>
<set name="children" cascade="all-delete-orphan" inverse="true">
<key column="PARENT_ID" foreign-key="CHILD_FK1"/>
<one-to-many class="Child"/>
</set>
</class>
<class name="Child"
<id name="id" type="long" column="ID" unsaved-value="null">
<generator class="sequence">
<param name="sequence">SEQ_T_CHILD</param>
</generator>
</id>
<property name="businessKey" column="BUSINESSKEY" not-null="true"/>
</class>
</hibernate-mapping>
I then do:
Criteria parentCriteria = aSession.createCriteria(Parent.class);
parentCriteria.createAlias("children", "c", CriteriaSpecification.LEFT_JOIN);
parentCriteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
parentCriteria.add(Restrictions.eq("c.businessKey", 123456789));
List parents = parentCriteria.list();
Expected behaviour: Since each parent in parents is a materialized entity, I'd expect its children set to contain all its children.
Observed behaviour: It contains only children with matching business key.
Is my expectation correct?
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-5550) Hibernate.createBlob() fails when used in current_session_context_class=thread mode
by Zemian Deng (JIRA)
Hibernate.createBlob() fails when used in current_session_context_class=thread mode
-----------------------------------------------------------------------------------
Key: HHH-5550
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5550
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.5
Reporter: Zemian Deng
See https://forum.hibernate.org/viewtopic.php?f=1&t=1004366
Here is a unit test failed case:
{code:java}
package deng.hibernate.examples.blob;
import org.hibernate.*;
import org.hibernate.cfg.*;
import org.junit.Test;
public class HibernateCreateBlobFailedCase {
@Test
public void createBlob() {
Configuration cfg = new Configuration();
SessionFactory sessionFactory = cfg.configure().buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
byte[] blobBytes = new byte[]{};
Hibernate.createBlob(blobBytes, session);
} catch (Throwable e) {
tx.rollback();
throw new RuntimeException(e);
} finally {
sessionFactory.close();
}
}
}
{code}
Set hibernate.cfg.xml with thread session context
{code:xml}
...
<property name="current_session_context_class">thread</property>
...
{code}
You will get this stack trace
{noformat}
java.lang.RuntimeException: java.lang.ClassCastException: $Proxy4 cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
at deng.hibernate.examples.blob.HibernateCreateBlobFailedCase.createBlob(HibernateCreateBlobFailedCase.java:24)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassCastException: $Proxy4 cannot be cast to org.hibernate.engine.jdbc.LobCreationContext
at org.hibernate.Hibernate.getLobCreator(Hibernate.java:502)
at org.hibernate.Hibernate.getLobCreator(Hibernate.java:498)
at org.hibernate.Hibernate.createBlob(Hibernate.java:494)
at deng.hibernate.examples.blob.HibernateCreateBlobFailedCase.createBlob(HibernateCreateBlobFailedCase.java:21)
... 22 more
{noformat}
As described in forum, this problem occurred because the session object we get using {{sessionFactory.getCurrentSession();}} is an wrapped ThreadLocalSessionContext instance that can not be cast into LobCreationContext. There is no easy way to unwrap and get the original session object, to pass to createBlob method.
--
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
15 years, 2 months