[Hibernate-JIRA] Created: (HHH-2831) Native SQL queries with addJoin or <return-join/> return object arrays instead of single Entities
by Jeremy Grodberg (JIRA)
Native SQL queries with addJoin or <return-join/> return object arrays instead of single Entities
-------------------------------------------------------------------------------------------------
Key: HHH-2831
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2831
Project: Hibernate3
Issue Type: Bug
Components: query-sql
Affects Versions: 3.2.5, 3.2.4
Environment: Hibernate 3.2.4.ga and 3.2.5.ga with hsqldb on Win XP
Reporter: Jeremy Grodberg
Attachments: NativeSQLQueriesTest.patch
Although the documentation is not crystal clear, I read it to say that using addJoin should eagerly fetch an associated object but should NOT return it as a separate value. In section 16.1.3. "Handling associations and collections" of the online documentation it says: "It is possible to eagerly join in the Dog to avoid the possible extra roundtrip for initializing the proxy. This is done via the addJoin() method, which allows you to join in an association or collection." This comes BEFORE the section on returning multiple entities, so I say the documentation at least implies it will only return a single entity at the top level. Also, if the intention is to return multiple entities, addEntity() works fine for that, so what then would be the difference of addJoin()? If I'm wrong about what addJoin() should do, please clarify that in the documentation and also clarify how, if it is possible, one could eagerly fetch the association without changing the return type of the quer
y.
I have reproduced this problem in the Hibernate JUnit tests in 3.2.4.ga and 3.2.5.ga, specifically NativeSQLQueriesTest.testSQLQueryInterface().
I'm attaching a patch to the Hibernate junit test org.hibernate.test.sql.hand.query.NativeSQLQueriesTest.java released in 3.2.5.ga that adds a test to ensure that a query with addJoin only returns a (list of) entities, not a list of Object arrays containing entities. Currently, the assertion fails because instead of returning a list of Organizations we get a list of Object[3] = { Organization, Employment, Person }, which is exactly what we get when the addJoin()s are replaced with appropriate addEntity() calls.
--
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, 1 month
[Hibernate-JIRA] Created: (BVAL-198) Simplify creation of ConstraintViolationExceptions
by Gunnar Morling (JIRA)
Simplify creation of ConstraintViolationExceptions
--------------------------------------------------
Key: BVAL-198
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-198
Project: Bean Validation
Issue Type: Improvement
Components: spec-general
Affects Versions: 1.1
Reporter: Gunnar Morling
javax.validation.ConstraintViolationException wraps a set of constraint violations, currently in the following form:
Set<ConstraintViolation<?>> constraintViolations
As the exception's constructors have a parameter of the same type, instantiating it is not as easy as expected:
Validator validator = ...;
DomainObject domainObject = new DomainObject();
Set<ConstraintViolation<DomainObject>> constraintViolations = validator.validate(domainObject);
//compiler error: ("The constructor ConstraintViolationException(Set<ConstraintViolation<DomainObject>>) is undefined")
throw new ConstraintViolationException(constraintViolations);
//this works
throw new ConstraintViolationException(new HashSet<ConstraintViolation<?>>(constraintViolations));
This problem can be solved by changing the collection type to
Set<? extends ConstraintViolation<?>>
The exception then would read as follows:
public class ConstraintViolationException extends ValidationException {
private final Set<? extends ConstraintViolation<?>> constraintViolations;
public ConstraintViolationException(String message, Set<? extends ConstraintViolation<?>> constraintViolations) {
super( message );
this.constraintViolations = constraintViolations;
}
public ConstraintViolationException(Set<? extends ConstraintViolation<?>> constraintViolations) {
super();
this.constraintViolations = constraintViolations;
}
public Set<ConstraintViolation<?>> getConstraintViolations() {
return new HashSet<ConstraintViolation<?>>(constraintViolations);
}
}
This makes the exception easier to use for producers, while maintaining simplicity for clients (since getConstraintViolations() still returns a Set<ConstraintViolation<?>>, clients don't have to do deal with the bound wildcard expression).
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-6127) Wrong save or read unicode value on @Lob String field in PostgreSQL 8.4
by Mihail Slobodyanuk (JIRA)
Wrong save or read unicode value on @Lob String field in PostgreSQL 8.4
-----------------------------------------------------------------------
Key: HHH-6127
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6127
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.3
Environment: PostgreSQL 8.4.5 on Ubuntu 32, Hibernate 3.6.0 - 3.6.3, jdbc driver: postgresql-8.3-603.jdbc3
Reporter: Mihail Slobodyanuk
Priority: Critical
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost/test</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">postgres</property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.connection.charSet">UTF-8</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
</session-factory>
</hibernate-configuration>
@Entity
public class ReportTemplate{
@Id
@GeneratedValue
private Integer id;
@Lob
private String body;
...
}
At save (or at read) operation with 'body' field value is broken. In DB stored Blob's OID.
The next code throw AssertionError:
String str="Русский текст";//Unicode string
rt = new ReportTemplate();
rt.setBody(str);
Serializable id = hsm.getSession().save(rt);
hsm.commit();
hsm.getSession().clear();
rt = (ReportTemplate) hsm.getSession().get(ReportTemplate.class, id);
assert str.equals(rt.getBody());
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-5971) Bad performance UpdateTimestampsCache ReentrantReadWriteLock
by Fernando Paris (JIRA)
Bad performance UpdateTimestampsCache ReentrantReadWriteLock
------------------------------------------------------------
Key: HHH-5971
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5971
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.1
Environment: hibernate 3.6.1, jboss as eap 4.3
Reporter: Fernando Paris
Priority: Critical
Performance bootleneck created by UpdateTimestampsCache invalidate, generating full heap. On the threaddump have 346 threads waiting for
"ajp-0.0.0.0-5490-251" daemon prio=10 tid=0x00002aabc683c000 nid=0x7673 waiting on condition [0x000000005b4da000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00002aaac1c8c9d0> (a java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:778)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1114)
at java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:807)
at org.hibernate.cache.UpdateTimestampsCache.invalidate(UpdateTimestampsCache.java:88)
at org.hibernate.engine.ActionQueue$AfterTransactionCompletionProcessQueue.afterTransactionCompletion(ActionQueue.java:604)
at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:209)
at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:602)
at org.hibernate.jdbc.JDBCContext.afterNontransactionalQuery(JDBCContext.java:292)
at org.hibernate.impl.SessionImpl.afterOperation(SessionImpl.java:595)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1273)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1024)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1015)
at com.rumbo.hotel.dbaccess.dao.impl.DhotMetadataDAOImpl.getByDescriptionKey(DhotMetadataDAOImpl.java:46)
at com.rumbo.alojamientos.tools.parameter.HotelParameterCacheManager.getParameter(HotelParameterCacheManager.java:113)
at com.rumbo.alojamientos.tools.parameter.HotelParameterCacheManager.getParameterValue(HotelParameterCacheManager.java:76)
at com.rumbo.alojamientos.tools.parameter.HotelParameterCacheManager.getParameterValue(HotelParameterCacheManager.java:87)
at com.rumbo.alojamientos.tools.logging.LoggingUtilities.isLogWritingActive(LoggingUtilities.java:189)
at com.rumbo.alojamientos.tools.logging.LoggingUtilities.isLogWritingActive(LoggingUtilities.java:232)
at com.rumbo.alojamientos.tools.logging.LoggingUtilities.saveLog(LoggingUtilities.java:141)
at com.rumbo.hoteles.ws.interceptor.LoggingInterceptor.saveLog(LoggingInterceptor.java:168)
at com.rumbo.hoteles.ws.interceptor.LoggingInterceptor.handleRequest(LoggingInterceptor.java:94)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:213)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.rumbo.mvc.encoding.EncodingFilter.doFilter(EncodingFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:543)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:381)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
--
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, 1 month