[Hibernate-JIRA] Created: (HHH-3967) Great performance improvement for CascadingAction.PERSIST_ON_FLUSH action !!
by Guenther Demetz (JIRA)
Great performance improvement for CascadingAction.PERSIST_ON_FLUSH action !!
----------------------------------------------------------------------------
Key: HHH-3967
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3967
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.1
Environment: 3.3.1 GA , SQLServer
Reporter: Guenther Demetz
Sometimes large stateful transactions are unavoidable and especially when having several large persistent collections in dirty state,
flushing becomes gradually more cpu intensive and slowly.
Analizing several stacktraces I detected that the thread most time is executing at the same point in reflection ,
see here a typical stacktrace:
java.lang.Class.isAssignableFrom(Native Method)
sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:36)
...
java.lang.reflect.Field.get(Field.java:358)
DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:55)
PojoEntityTuplizer(AbstractEntityTuplizer).getPropertyValue(Object, int) line: 300
SingleTableEntityPersister(AbstractEntityPersister).getPropertyValue(Object, int, EntityMode) line: 3609
Cascade.cascade(EntityPersister, Object, Object) line: 172
...
Making further investigations, I saw that:
- CascadingAction.PERSIST_ON_FLUSH requires NoCascadeChecking
- for all kind of properties the noCascade implementation is called
- regarding noCascade implementation checks only properties of type Entity !
public static final CascadingAction PERSIST_ON_FLUSH = new CascadingAction() {
...
public void noCascade(EventSource session, Object child, Object parent, EntityPersister persister, int propertyIndex) {
...
Type type = persister.getPropertyTypes()[propertyIndex];
if ( type.isEntityType() ) {
... check and throw eventually a TransientObjectException
}
}
Thus most property values are retrieved by reflection in vain as they are not of type entity.
With following code addition in org.hibernate.engine.Cascade.java
I was able do avoid most reflection method calls without affecting the behaviour:
org.hibernate.engine.Cascade.java
...
public void cascade(final EntityPersister persister, final Object parent, final Object anything) throws HibernateException {
...
else if ( action.requiresNoCascadeChecking() ) {
// Line:162
// begin Improvement
if (action == CascadingAction.PERSIST_ON_FLUSH) {
Type type = persister.getPropertyTypes()[i];
if ( !type.isEntityType() ) {
// Remark: goes only well as long PERSIST_ON_FLUSH noCascade implementation checks only entities
continue;
}
}
// end Improvement
action.noCascade(
eventSource,
persister.getPropertyValue( parent, i, entityMode ),
parent,
persister,
i
);
...
best regards
Guenther D.
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-6039) jpaEntityName not set when using Hibernate mapping
by JOUFFRE Nelly (JIRA)
jpaEntityName not set when using Hibernate mapping
--------------------------------------------------
Key: HHH-6039
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6039
Project: Hibernate Core
Issue Type: Bug
Components: metamodel, query-criteria
Affects Versions: 3.6.2
Environment: hibernate-(core, entitymanager...)-3.6.2.Final
hibernate-jpa-2.0-api-1.0.0.Final
MySQL 5.1
Spring 3.0.5.RELEASE
Reporter: JOUFFRE Nelly
Attachments: Qualifier.hbm.xml
I'm trying to run the following query
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Qualifier> cq = cb.createQuery(Qualifier.class);
Root<Qualifier> qualifRoot = cq.from(Qualifier.class);
List<Qualifier> results = entityManager.createQuery(cq).getResultList();
The Qualifier class is mapped using Hibernate hbm.xml mapping (see attachement)
The entityManagerFactory is configured using a Spring class
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
...
</bean>
This Criteria query throws the exception: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: null near line 1, column 29 [select generatedAlias0 from null as generatedAlias0]
The FROM clause, which here is null, is built using the EntityType.jpaEntityName property which value comes from PersistentClass.jpaEntityName property. But this property is never set when context is loaded to build the Metamodel.
Is this property not set because the mapping is an hibernate mapping and not a JPA one ? or is it 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
12 years, 11 months
[Hibernate-JIRA] Created: (HHH-3655) Select Query Using JPA and Static Inner Class
by Caine Lai (JIRA)
Select Query Using JPA and Static Inner Class
---------------------------------------------
Key: HHH-3655
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3655
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Environment: Hibernate Version 3.3.1 GA, using JPA. MySQL DB.
Reporter: Caine Lai
Attachments: HibernateStaticInnerClassBug.zip
I want to collect some statistics using JPA and return them all as a value object to my web tier. In my value object I have a static inner class I would like to use for the JPA query.
My Class:
public class GeneralVendorStatsVO {
private List<StatusCounts> statusCounts = new ArrayList<StatusCounts>();
/**
* Inner class for holding status counts for vendors.
*/
public static class StatusCounts {
private UserStatus status;
private Long count;
public StatusCounts(UserStatus status, Long count) {
this.status = status;
this.count = count;
}
public UserStatus getStatus() { return status; }
public void setStatus(UserStatus status) { this.status = status; }
public Long getCount() { return count; }
public void setCount(Long count) { this.count = count; }
}
// ********************** Accessor Methods ********************** //
public List<StatusCounts> getStatusCounts() { return statusCounts; }
public void setStatusCounts(List<StatusCounts> statusCounts) { this.statusCounts = statusCounts; }
}
And here is the method I am trying to execute:
public GeneralVendorStatsVO getGeneralVendorStats() {
GeneralVendorStatsVO vo = new GeneralVendorStatsVO();
// Get the status counts.
String queryString = "SELECT new vo.stats.vendor.GeneralVendorStatsVO.StatusCounts(user.status, count(user)) FROM User user GROUP BY user.status";
Query query = this.em.createQuery(queryString);
List<GeneralVendorStatsVO.StatusCounts> statusCounts = query.getResultList();
vo.setStatusCounts(statusCounts);
for (GeneralVendorStatsVO.StatusCounts entry : statusCounts) {
log.debug("Status: " + entry.getStatus()+ "Count: " + entry.getCount());
}
return vo;
}
The error:
org.hibernate.hql.ast.QuerySyntaxException: Unable to locate class [vo.stats.vendor.GeneralVendorStatsVO.StatusCounts]
I don't know why this would not work, when I can do:
new GeneralVendorStatsVO.StatusCounts(UserStatus.APPROVED, 200L)
I was told I should open an issue because it seems like a bug. More info here: http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=78...
--
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
12 years, 11 months
[Hibernate-JIRA] Created: (METAGEN-75) Maven plugin and JPA XML configuration path problem
by Nickolay Mazurkin (JIRA)
Maven plugin and JPA XML configuration path problem
---------------------------------------------------
Key: METAGEN-75
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-75
Project: Hibernate Metamodel Generator
Issue Type: Bug
Components: processor
Affects Versions: 1.1.1.Final
Environment: Ubuntu, Maven 2, Java 6
Reporter: Nickolay Mazurkin
Assignee: Hardy Ferentschik
I have a problem with generating metamodel from JPA configuation
I have JPA config like the following - there are a lot of ORM mapping in relative subdirectories
<persistence-unit name="ApplicationDataSource" transaction-type="RESOURCE_LOCAL">
<description>Main persistence descriptor</description>
<mapping-file>configuration/model/jpa/mappings/base.xml</mapping-file>
<mapping-file>configuration/model/jpa/mappings/entities/employer.xml</mapping-file>
<mapping-file>configuration/model/jpa/mappings/entities/unit/unit.xml</mapping-file>
...
<mapping-file>configuration/model/jpa/mappings/entities/unit/maintenance.xml</mapping-file>
</persistence-unit>
The problem is that processor is not able to find all these mappings without trailing slash. The following config works with metamodel processor
<persistence-unit name="ApplicationDataSource" transaction-type="RESOURCE_LOCAL">
<!-- with trailing slash -->
<mapping-file>/configuration/model/jpa/mappings/base.xml</mapping-file>
</persistence-unit>
But the trailing slash doesn't allow the config to be loaded by Hibernate org.hibernate.ejb.Ejb3Configuration - Hibernate fails to load the config with trailing slash
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months
[Hibernate-JIRA] Created: (METAGEN-73) Refactoring of the Generated annotation
by Théo Chamley (JIRA)
Refactoring of the Generated annotation
---------------------------------------
Key: METAGEN-73
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-73
Project: Hibernate Metamodel Generator
Issue Type: Improvement
Affects Versions: 1.2.next
Reporter: Théo Chamley
Assignee: Hardy Ferentschik
Priority: Minor
Attachments: hibernate-jpamodelgen-refactoring-generated-annotation.diff
You will find as an attached file a patch to modify the Generated annotation of the JPA MetaModels.
The value element of the annotation is now the name of the processor.
If activated, the annotation as an element date which that indicates when the file has been generated. This element date may be a problem when you try to compare several generated files, so you can remove it with the option -AremoveDateFromGeneratedAnnotation=true.
Hope this helps,
--
Théo
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months
[Hibernate-JIRA] Created: (METAGEN-74) @Column(columnDefinition = ...) ignored unless placed by get method.
by jee4hire (JIRA)
@Column(columnDefinition = ...) ignored unless placed by get method.
--------------------------------------------------------------------
Key: METAGEN-74
URL: http://opensource.atlassian.com/projects/hibernate/browse/METAGEN-74
Project: Hibernate Metamodel Generator
Issue Type: Bug
Environment: Linux omega 2.6.32-33-generic-pae #71-Ubuntu SMP Wed Jul 20 18:46:41 UTC 2011 i686 GNU/Linux
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
jboss-as-7.0.0.Final
mysql-connector-java-5.1.15.jar
mysql-server-5.1 (5.1.41-3ubuntu12.10)
Reporter: jee4hire
Assignee: Hardy Ferentschik
>>>Not working: @Column is placed with variable definition.
Column data is created in database as type tinyblob.
Thus, @Column(columnDefinition = "blob") is ignored.
@Entity
public class File implements Serializable {
private Long id;
@NotNull @Column(columnDefinition = "blob")
private byte [] data;
@Id @GeneratedValue
public Long getId() { return id; }
public void setId(Long i) { id = i; }
public byte [] getData() { return data; }
public void setData(byte [] d) { data = d; }
}
##############################################################################
>>>Workaround: @Column is placed with get method.
Then, column data is created in database as type blob.
@Entity
public class File implements Serializable {
private Long id;
private byte [] data;
@Id @GeneratedValue
public Long getId() { return id; }
public void setId(Long i) { id = i; }
@NotNull @Column(columnDefinition = "blob")
public byte [] getData() { return data; }
public void setData(byte [] d) { data = d; }
}
##############################################################################
Excerpt from: jboss-as-7.0.0.Final/standalone/configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://localhost:3306/jboss
</connection-url>
<driver>
com.mysql
</driver>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<pool>
<min-pool-size>
10
</min-pool-size>
<max-pool-size>
100
</max-pool-size>
<prefill>
true
</prefill>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
*************
</user-name>
<password>
*************
</password>
</security>
<statement>
<prepared-statement-cache-size>
32
</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
<drivers>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>
com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
</xa-datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>
org.h2.jdbcx.JdbcDataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
##############################################################################
war jars:
61504 Defl:N 56482 8% 2011-07-21 10:31 92d0520b WEB-INF/lib/i18nlog-1.0.10.jar
358085 Defl:N 324832 9% 2011-04-04 11:37 8c574f28 WEB-INF/lib/log4j-1.2.12.jar
47399 Defl:N 41460 13% 2011-07-21 10:31 ac044dbb WEB-INF/lib/jboss-logging-3.0.0.Beta5.jar
204093 Defl:N 181695 11% 2011-07-07 12:54 ed9a2ff2 WEB-INF/lib/picketlink-idm-core-1.5.0.Alpha02.jar
55966 Defl:N 44907 20% 2011-07-07 12:54 d81b0cc2 WEB-INF/lib/seam-international-3.0.0.Final.jar
529064 Defl:N 490198 7% 2011-07-18 14:13 cb9a1aec WEB-INF/lib/quartz-2.0.1.jar
1627515 Defl:N 1470306 10% 2011-07-07 12:54 e71d8ef4 WEB-INF/lib/primefaces-3.0.M2.jar
231287 Defl:N 203688 12% 2011-07-21 10:31 76154858 WEB-INF/lib/jboss-marshalling-1.3.0.CR9.jar
2479225 Defl:N 2249049 9% 2011-08-03 07:41 f775e5eb WEB-INF/lib/richfaces-components-ui-4.1.0-20110802.221239-82.jar
543011 Defl:N 456324 16% 2011-07-12 14:02 f915bdef WEB-INF/lib/joda-time-1.6.1.jar
80863 Defl:N 74890 7% 2011-07-21 10:31 1074f519 WEB-INF/lib/jboss-marshalling-river-1.3.0.CR9.jar
153633 Defl:N 139858 9% 2011-07-18 08:58 267a0105 WEB-INF/lib/seam-security-impl-3.0.1-20110624.041853-12.jar
546379 Defl:N 489412 10% 2011-07-21 10:38 7810d5c7 WEB-INF/lib/jboss-common-core-2.2.17.GA.jar
161455 Defl:N 122304 24% 2011-07-12 15:10 55c0bc93 WEB-INF/lib/knowledge-api-5.2.0.Final.jar
1902276 Defl:N 1719856 10% 2011-07-12 15:10 91eaa4f6 WEB-INF/lib/drools-core-5.2.0.Final.jar
15071 Defl:N 12479 17% 2011-04-04 11:31 a1e02acb WEB-INF/lib/jta-1.1.jar
7635 Defl:N 5428 29% 2011-07-21 10:31 ed71d5ec WEB-INF/lib/rhq-pluginAnnotations-3.0.1.jar
897071 Defl:N 858346 4% 2011-07-12 15:16 a1635c95 WEB-INF/lib/antlr-3.3.jar
91540 Defl:N 81205 11% 2011-07-25 08:27 6d5bdd9e WEB-INF/lib/seam-config-xml-3.0.1-20110723.041850-8.jar
443432 Defl:N 420698 5% 2011-05-16 12:02 d108cdd2 WEB-INF/lib/antlr-2.7.6.jar
1674737 Defl:N 1601274 4% 2011-07-07 12:55 b5de0b5f WEB-INF/lib/ecj-3.5.1.jar
10899 Defl:N 7710 29% 2011-07-21 10:31 b580639d WEB-INF/lib/jboss-transaction-api-1.0.1.GA.jar
15808 Defl:N 12066 24% 2011-07-07 12:54 cbb7cd31 WEB-INF/lib/sac-1.3.jar
269014 Defl:N 245020 9% 2011-06-20 14:42 0d19c92a WEB-INF/lib/commons-net-3.0.1.jar
1472606 Defl:N 1320427 10% 2011-07-21 10:31 0084c472 WEB-INF/lib/infinispan-core-5.0.0.CR7.jar
7457 Defl:N 5972 20% 2011-07-18 14:13 cdac3310 WEB-INF/lib/quartz-jboss-2.0.1.jar
713433 Defl:N 657365 8% 2011-07-12 15:10 3e88a598 WEB-INF/lib/mvel2-2.1.0.drools2.jar
12623 Defl:N 10267 19% 2011-07-21 10:38 77d0c4ba WEB-INF/lib/jboss-logging-spi-2.1.0.GA.jar
253950 Defl:N 241386 5% 2011-05-12 11:27 f758d70e WEB-INF/lib/cssparser-0.9.5.jar
1114265 Defl:N 987976 11% 2011-05-12 11:27 57d773f1 WEB-INF/lib/guava-r08.jar
25496 Defl:N 22183 13% 2011-07-14 12:55 1a95d60b WEB-INF/lib/slf4j-api-1.6.1.jar
85262 Defl:N 64318 25% 2011-08-03 07:41 09f14670 WEB-INF/lib/richfaces-components-api-4.1.0-20110802.221059-82.jar
119223 Defl:N 103690 13% 2011-07-18 08:58 fb1581b3 WEB-INF/lib/seam-persistence-3.0.1-20110711.040751-17.jar
148627 Defl:N 138829 7% 2011-07-12 15:16 3e8b388d WEB-INF/lib/stringtemplate-3.2.1.jar
397907 Defl:N 343667 14% 2011-07-07 12:54 7f34b227 WEB-INF/lib/seam-solder-3.0.0.Final.jar
102661 Defl:N 80043 22% 2011-07-07 12:54 b67dd2a4 WEB-INF/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
2135793 Defl:N 2028099 5% 2011-07-21 10:31 ade69d61 WEB-INF/lib/jgroups-2.12.0.Final.jar
988489 Defl:N 902079 9% 2011-07-12 15:16 22c8db9d WEB-INF/lib/drools-compiler-5.2.0.Final.jar
424253 Defl:N 391533 8% 2011-08-04 07:24 9a1f5dba WEB-INF/lib/richfaces-core-impl-4.1.0-20110803.165959-73.jar
83291 Defl:N 68465 18% 2011-08-03 07:41 d9920651 WEB-INF/lib/seam-servlet-3.0.1-20110803.040537-7.jar
33716 Defl:N 23689 30% 2011-07-18 08:58 3a591eab WEB-INF/lib/seam-security-api-3.0.1-20110624.041806-12.jar
163650 Defl:N 149460 9% 2011-07-12 15:16 e8acd98f WEB-INF/lib/antlr-runtime-3.3.jar
136498 Defl:N 115026 16% 2011-08-04 07:24 010242c6 WEB-INF/lib/richfaces-core-api-4.1.0-20110803.165751-75.jar
608376 Defl:N 554163 9% 2011-07-14 12:55 4bb8e85b WEB-INF/lib/c3p0-0.9.1.1.jar
23055 Defl:N 14694 36% 2011-07-07 12:54 5dfcdff2 WEB-INF/lib/picketlink-idm-spi-1.5.0.Alpha02.jar
27714 Defl:N 18846 32% 2011-07-07 12:54 9718b1ca WEB-INF/lib/picketlink-idm-api-1.5.0.Alpha02.jar
25717 Defl:N 20670 20% 2011-07-07 12:54 8473b909 WEB-INF/lib/picketlink-idm-common-1.5.0.Alpha02.jar
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 11 months