[Hibernate-JIRA] Created: (HHH-4637) Check whether any custom entity/collection's cache usage is correct
by Galder Zamarreno (JIRA)
Check whether any custom entity/collection's cache usage is correct
-------------------------------------------------------------------
Key: HHH-4637
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4637
Project: Hibernate Core
Issue Type: New Feature
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Fix For: 3.5
[quote from Brian]Next, re: collection caching: I noticed that my collection caches weren't being created by the InfinispanRegionFactory (and no exceptions were thrown when I set custom eviction settings for them), so I looked through SessionFactoryImpl in the Hibernate code and saw that I have to explicitly set <cache usage=transactional/> on each collection, even if the owning entity has the transactional cache usage set (otherwise SessionFactoryImpl will never call buildCollectionRegion and collection caching won't get turned on). Is this the intended behavior (that the cache usage has to be set explicitly on each collection)? If so it might be useful to throw an exception in the InfinispanRegionFactory if the cache usage isn't set up as above, since in my case I had custom eviction settings for a collection that referred to a cache region that didn't exist. [/quote]
Hmmm, I suppose InfinispanRegionFactory might be able to check for any custom settings for any entity/collection and do a check for it, i.e. check if cache usage is transactional or read-only. Any other time where there's no specific setting per entity/collection, I don't think we can do that.
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268562#4268562
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-4693) MapProxy - problems during marshalling/demarchalling
by Lawrence McAlpin (JIRA)
MapProxy - problems during marshalling/demarchalling
----------------------------------------------------
Key: HHH-4693
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4693
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.0-Beta-2
Environment: envers version: 1.2.1-hibernate-3.3, 3.5.0-Beta-2
hsqldb, sybase
Reporter: Lawrence McAlpin
Priority: Minor
Attachments: testsrc.zip, transient.patch
This is related to an issue resolved in HHH-4488.
When attempting to serialize an @audited entity that contains a Map, we get the following exception:
Caused by: java.io.NotSerializableException: org.hibernate.envers.entities.mapper.relation.lazy.initializor.MapCollectionInitializor
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
In the patch submitted with HHH-4488, the collection initializer for a CollectionProxy was made transient. However, MapProxy and SortedMapProxy do not extend from CollectionProxy and have their own collection initializer field. My patch simply marks it transient in those classes as well.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-4068) Hibernate's ReadWriteCache synchronization slow down ehcache
by shaoxian yang (JIRA)
Hibernate's ReadWriteCache synchronization slow down ehcache
-------------------------------------------------------------
Key: HHH-4068
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4068
Project: Hibernate Core
Issue Type: Bug
Reporter: shaoxian yang
Hi, I am setting up hibernate to work with ehcache. Hibernate has a wrapper to call underlying ehcache.
Their wrappers are ReadWriteCache.java, which internally will call Ehcache. The two major methods in ReadWriteCache are synchronized:
public synchronized Object get(Object key, long txTimestamp) throws CacheException {
public synchronized boolean put(
Object key,
Object value,
long txTimestamp,
Object version,
Comparator versionComparator,
boolean minimalPut)
I understand this is to ensure "read/write" strategy to read committed (when write and read thread get in at the same time, read does not get intermediate result and only get the latest committed result).
However, isn't this also make concurrent read impossible when there is no write? ).
It looks like we need some more advanced read/write lock at ReadWriteCache level. However, the class also have other synchronized methods which make me hesitate:
public synchronized SoftLock lock(Object key, Object version) throws CacheException
public synchronized void release(Object key, SoftLock clientLock) throws CacheException
public synchronized boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock)
throws CacheException
public synchronized boolean afterInsert(Object key, Object value, Object version)
throws CacheException
public synchronized SoftLock lock(Object key, Object version) throws CacheException
Basically I want to get the most out of ehcache performance gain. Currently, if I keep issuing the same query which read item from query cache, there is still overhead.
Can you advise me why we have to use read lock for every read when there is no write? And is it necessary to acquire lock for any other operation than put/get in ReadWriteCache class?
Thanks in advance.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-4455) Changes are not properly rollbacked after a bulk operation involving classes that use joined-subclass mapping
by dilbert (JIRA)
Changes are not properly rollbacked after a bulk operation involving classes that use joined-subclass mapping
-------------------------------------------------------------------------------------------------------------
Key: HHH-4455
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4455
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.0.SP1, 3.2.5
Environment: Hibernate 3.2.5.ga and 3.3.0.SP1
MySql database version 5.1.36
Driver : mysql-connector-java-5.1.6
Reporter: dilbert
Attachments: TransactionTest.zip
I have a Location class on which two other classes "depend" (Contact and LocationTransaction).
When I want to delete a Location Object I use bulk update operations. First I delete the LocationTransactions
connected to the Location object and then I delete the contact objects connected to the location object. Finally
I delete the Location object itself. At the end I simulate that something went wrong and trigger a Rollback.
After the rollback I would expect that none of the objects that I tried to delete was actually deleted. However,
all the LocationTransaction objects are missing from the database after the rollback. Since the other objects
are rollbacked properly I figure that the problem is connected to the fact that LocationTransactions is inherited
from Transaction and uses joined-subclass mapping which is included in the test project in the attachment.
private static void doTest() {
final Session s = sf.openSession();
final Transaction tx = s.beginTransaction();
try {
Location l = (Location) s.createQuery("from Location l where l.name = 'l1'").uniqueResult();
final Query deleteTransactionQuery = s.createQuery(
"delete from LocationTransaction lt " +
"where lt.location = (:location)");
deleteTransactionQuery.setParameter("location", l);
deleteTransactionQuery.executeUpdate();
final Query deleteContactQuery = s.createQuery(
"delete from Contact c " +
"where c.location = (:location)");
deleteContactQuery.setParameter("location", l);
deleteContactQuery.executeUpdate();
final Query deleteQuery = s.createQuery(
"delete from Location l where l = (:location)");
deleteQuery.setParameter("location", l);
deleteQuery.executeUpdate();
//s.delete(l);
throw new RuntimeException("test");
//tx.commit();
} catch (Exception e) {
tx.rollback();
System.out.println(e);
} finally {
s.close();
}
}
Please contact me with any further questions.
Thanks for the help.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2094) Hibernate is ignoring native sql aliases and generating "column not found" error
by Leonardo Penczek (JIRA)
Hibernate is ignoring native sql aliases and generating "column not found" error
--------------------------------------------------------------------------------
Key: HHH-2094
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2094
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.2.0.cr4
Environment: 3.2.0.cr4, Adaptive Server Enterprise/12.5.3
Reporter: Leonardo Penczek
Priority: Critical
As simples as that:
1: Query q = em.createNativeQuery("select cd_person as codePerson, cd_person as identif from PERSON");
2: List<Object[]> resultList = (List<Object[]>) q.getResultList();
Hibernate is ignoring my aliases when retrieving information from the ResultSet because it is trying to retrieve by column name, generating the following error:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:641)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at <my line 2 in the code above>
...
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
...
Caused by: java.sql.SQLException: S0022: Invalid column name 'cd_person'.
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.tds.TdsResultSet.findColumnByLabel(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.findColumn(Unknown Source)
at com.sybase.jdbc3.jdbc.SybResultSet.getInt(Unknown Source)
at org.jboss.resource.adapter.jdbc.WrappedResultSet.getInt(WrappedResultSet.java:690)
at org.hibernate.type.IntegerType.get(IntegerType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:139)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:474)
at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:420)
at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:317)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:594)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
Awesome! The SQL query runs, but the Hibernate try to get the column by the original name, not by the alias, causing the error!
It is not possible to correctly get the value of 2 different columns that have the same name!!!!
Hint: why Hibernate use ResultSet.get* by column name instead of positional ResultSet.get* (1, 2, 3,...)? It will solve this problem.
--
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, 11 months