[Hibernate-JIRA] Created: (HHH-5291) Hibernate generates several join clauses for same table
by Igor Nikolaev (JIRA)
Hibernate generates several join clauses for same table
-------------------------------------------------------
Key: HHH-5291
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5291
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2
Environment: Hibernate 3.5.2
Reporter: Igor Nikolaev
Suppose you've got a mapping:
<class name="Class" table="TABLE1" dynamic-update="true">
<id name="id" type="int">
<column name="ID" />
<generator class="assigned" />
</id>
<discriminator column="CLASS_TYPE"/>
<property name="property1" type="string" column="PROPERTY1" update="false" insert="false"/>
<join table="TABLE2" optional="true">
<key column="ID" not-null="false"/>
<property name="property2" column="PROPERTY2"/>
</join>
<subclass name="Subclass" discriminator-value="SUBCLASS">
<join table="TABLE2">
<key column="swift_id"/>
<property name="property3" column="PROPERTY3"/>
</join>
</subclass>
</class>
As you can notice, we join the same table in subclass.
Expected result is that Hibernat generates a query like this one:
select
this_.ID,
this_.PROPERTY1,
this_1_.PROPERTY2,
this_1_.PROPERTY3
from
TABLE1 this_
left inner join
TABLE2 this_1_
on this_.ID=this_1_.ID
Instead, Hibernate joins TABLE2 twice and generates the following query:
select
this_.ID,
this_.PROPERTY1,
this_1_.PROPERTY2,
this_2_.PROPERTY3
from
TABLE1 this_
left inner join
TABLE2 this_1_
on this_.ID=this_1_.ID
left outer join
TABLE2 this_2_
on this_.ID=this_2_.ID
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-7020) Connection leak with nested sessions
by Zoltán Holub (JIRA)
Connection leak with nested sessions
------------------------------------
Key: HHH-7020
URL: https://hibernate.onjira.com/browse/HHH-7020
Project: Hibernate ORM
Issue Type: Bug
Components: core, entity-manager
Affects Versions: 4.0.1, 4.0.0.Final, 4.1.0
Environment: Windows 7.
Java 1.6.0_25, Java 1.7.0
Reporter: Zoltán Holub
Attachments: testcase-connectionleak.zip
I'am using a Hibernate interceptor to track data modifications. In the interceptor's onFlushDirty() method, i open a new session without interceptors using the same JDBC connection.
After closing this nested session and the original entitymanager, the JDBC connection doesn't released.
I could reproduce this problem outside any interceptor. I have made a junit test without interceptors which shows the same problem.
I have found that Hibernate throws and catches a HibernateException with message "proxy handle is no longer valid". This exception is logged on debug level.
I investigated that the problem is in the following code:
LogicalConnectionImpl.java
public Connection close() {
LOG.trace( "Closing logical connection" );
Connection c = isUserSuppliedConnection ? physicalConnection : null;
try {
releaseProxies();
jdbcResourceRegistry.close();
if ( !isUserSuppliedConnection && physicalConnection != null ) {
releaseConnection();
}
return c;
}
finally {
// no matter what
physicalConnection = null;
isClosed = true;
LOG.trace( "Logical connection closed" );
for ( ConnectionObserver observer : observers ) {
observer.logicalConnectionClosed();
}
observers.clear();
}
}
The invocation of jdbcResourceRegistry.close() throws this exception, and this is why it skips the following releaseConnection(). The condition of IF statement is true.
This code is new to Hibernate 4. I have tried 4.0.0, 4.0.1 and 4.1.0-SNAPSHOT and all of them has the problem. Hibernate 3.6.0 is not affected.
My JUnit test could run with Hibernate 3.x with minor changes. (3.x code also in the JUnit test)
I have tried different ways to work around the problem. The only way it worked is to use a simple doWork() and native JDBC operations. This test case also in the unit test.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HHH-7084) Caused by: java.lang.ClassCastException: cannot be cast to org.hibernate.dialect.Dialect
by Artem V. Navrotskiy (JIRA)
Caused by: java.lang.ClassCastException: cannot be cast to org.hibernate.dialect.Dialect
----------------------------------------------------------------------------------------
Key: HHH-7084
URL: https://hibernate.onjira.com/browse/HHH-7084
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Environment: Idea 11.0.02, JDK 7, GWT 2.4.0 Dev Mode, Hibernate 4.0.0+
Reporter: Artem V. Navrotskiy
Attachments: classloader.patch
If you run GWT application from JetBrains Idea in Dev Mode, GWT builds custom ClassLoader.
When Hibernate creates of any object by it's name (Dialect for example), if class available for SystemClassLoader it's will be created by SystemClassLoader. Not by a current ClassLoader.
This is due to the fact that the class ClassLoaderServiceImpl$1 uses SystemClassLoader as parent ClassLoader.
Stacktrace:
javax.persistence.PersistenceException: Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at ru.buzzsoft.common.HibernateHelper.createEntityManagerFactory(HibernateHelper.java:180)
at ru.buzzsoft.delivery.PersistentFactory.getEntityPersonalFactory(PersistentFactory.java:21)
at ru.buzzsoft.delivery.server.api.impl.ContextImpl.<init>(ContextImpl.java:126)
at ru.buzzsoft.delivery.server.api.impl.ContextImpl.<init>(ContextImpl.java:89)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:253)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:616)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:82)
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:64)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:146)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:88)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 32 more
Caused by: java.lang.ClassCastException: org.hibernate.dialect.H2Dialect cannot be cast to org.hibernate.dialect.Dialect
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.constructDialect(DialectFactoryImpl.java:73)
... 43 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 10 months
[Hibernate-JIRA] Created: (HV-264) Validation of List of primitives
by Michenaud Laurent (JIRA)
Validation of List of primitives
--------------------------------
Key: HV-264
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-264
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.0.1
Environment: Linux
Reporter: Michenaud Laurent
Hi,
I have a list of String in my bean :
These strings are email and i want to validate them.
So, i did in my bean :
@NotEmpty
@Email
//@Valid <= uncommenting that line doesnot change anything.
List<String> emails ;
At execution, i've got the error :
Exception in thread "main" javax.validation.UnexpectedTypeException: No validator could be found for type: java.util.List<java.lang.String>
at org.hibernate.validator.engine.ConstraintTree.verifyResolveWasUnique(ConstraintTree.java:236)
at org.hibernate.validator.engine.ConstraintTree.findMatchingValidatorClass(ConstraintTree.java:219)
at org.hibernate.validator.engine.ConstraintTree.getInitializedValidator(ConstraintTree.java:167)
at org.hibernate.validator.engine.ConstraintTree.validateConstraints(ConstraintTree.java:113)
at org.hibernate.validator.metadata.MetaConstraint.validateConstraint(MetaConstraint.java:121)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:334)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:278)
at org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:260)
at org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:213)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
at com.adeuza.movalys.validation.hibernate.TestMain.main(TestMain.java:75)
I don't know if it is a bug in hibernate validator. I have looked at the JSR303 and i have not seen anything
about List of primitives. You can validate per example List<Person> with @Valid and it works well because
the validator knows about Person class.
I have used a little the Oval framework and with it, you can tell if the check applies to the container,
or the values inside, or the keys(for map). I don't know if you can do that with JSR303.
I'm interesting with your point of view.
--
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, 10 months