[Hibernate-JIRA] Created: (HHH-6697) EntityManager.persist should through EntityExistsException instead of PersistenceException
by Michael Rudolf (JIRA)
EntityManager.persist should through EntityExistsException instead of PersistenceException
------------------------------------------------------------------------------------------
Key: HHH-6697
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6697
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.7
Environment: Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.5.0_22
Java home: C:\Program Files\Java\jdk1.5.0_22\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
Reporter: Michael Rudolf
The persist method of the {{EntityManager}} interface is not implemented according to the specification. If handed an already existing entity, it throws an instance of {{PersistenceException}} instead of {{EntityExistsException}}. The fact that the exception's cause is an instance of {{DuplicateEntityException}} does not help clients to determine the reason for the failure in a vendor-independent fashion. Changing this behavior will most likely not break existing clients, because they often catch instances of {{PersistenceException}}, which will also catch {{EntityExistsException}} instances. However, it will enable clients to detect the reason for the failure and thereby allow for better error reporting to the user. In fact, in case no transaction is running while this call fails, clients can also recover from the failure and queued actions can be committed afterwards.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[Hibernate-JIRA] Created: (HHH-6681) ArrayIndexOutOfBoundsException on enabling cache for a Native SQL query
by Samuel Mendenhall (JIRA)
ArrayIndexOutOfBoundsException on enabling cache for a Native SQL query
-----------------------------------------------------------------------
Key: HHH-6681
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6681
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.6.7
Environment: Hibernate 3.6.7-Final
ehcache 2.4.5
Reporter: Samuel Mendenhall
Fix For: 3.6.8
String sql = "select (SELECT count(*) from kcs.dw_reports as k, kcs.dw_link_rate as lr where k.id = lr.master_report_id and k.kerberos_name = :username and k.active = true and k.span_identifier = :yearMonth) as total," +
"(SELECT count(*) from kcs.dw_reports as k, kcs.dw_link_rate as lr where k.id = lr.master_report_id and k.kerberos_name = :username and k.active = true and k.span_identifier = :yearMonth and lr.linked_to_doc_id IS NULL) as unlinked";
try
{
beginTransaction();
results = getSession().createSQLQuery(sql)
.setParameter("username", username)
.setParameter("yearMonth", yearMonth)
.setCacheable(true)
.setReadOnly(true)
.list();
commitTransaction();
}
catch (HibernateException e)
{
rollbackTransaction();
e.printStackTrace();
log.error(e.getMessage());
}
Console log:
Hibernate:
select
(SELECT
count(*)
from
kcs.dw_reports as k,
kcs.dw_link_rate as lr
where
k.id = lr.master_report_id
and k.kerberos_name = ?
and k.active = true
and k.span_identifier = ?) as total,
(SELECT
count(*)
from
kcs.dw_reports as k,
kcs.dw_link_rate as lr
where
k.id = lr.master_report_id
and k.kerberos_name = ?
and k.active = true
and k.span_identifier = ?
and lr.linked_to_doc_id IS NULL) as unlinked
21:01:42,284 ERROR ViewLinkRateService:40 - 0
java.lang.ArrayIndexOutOfBoundsException: 0
at org.hibernate.type.TypeHelper.disassemble(TypeHelper.java:146)
at org.hibernate.cache.StandardQueryCache.put(StandardQueryCache.java:106)
at org.hibernate.loader.Loader.putResultInQueryCache(Loader.java:2434)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2321)
at org.hibernate.loader.Loader.list(Loader.java:2268)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
at com.jboss.support.server.KcsDao.getDwLinkRateNative(KcsDao.java:69)
at com.jboss.support.server.KcsDao.getLinkRateDataTable(KcsDao.java:128)
at com.jboss.support.server.service.ViewLinkRateService$2.run(ViewLinkRateService.java:31)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months
[Hibernate-JIRA] Created: (HHH-6684) SchemaExportManagedConnectionTest.testBothType() fails for dialects that support "if exists" on drop statements
by Gail Badner (JIRA)
SchemaExportManagedConnectionTest.testBothType() fails for dialects that support "if exists" on drop statements
---------------------------------------------------------------------------------------------------------------
Key: HHH-6684
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6684
Project: Hibernate Core
Issue Type: Bug
Components: testsuite
Reporter: Gail Badner
Assignee: Gail Badner
Fix For: 3.6.8
SchemaExportManagedConnectionTest.testBothType() fails for dialects that support "if exists" on drop statements.
java.lang.AssertionError: expected:<0> but was:<2>
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.failNotEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:126)
at org.junit.Assert.assertEquals(Assert.java:470)
at org.junit.Assert.assertEquals(Assert.java:454)
at org.hibernate.test.schemaupdate.SchemaExportTest.testBothType(SchemaExportTest.java:69)
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.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.hibernate.testing.junit4.FailureExpectedHandler.evaluate(FailureExpectedHandler.java:59)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
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.hibernate.testing.junit4.BeforeClassCallbackHandler.evaluate(BeforeClassCallbackHandler.java:43)
at org.hibernate.testing.junit4.AfterClassCallbackHandler.evaluate(AfterClassCallbackHandler.java:42)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:51)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:63)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:75)
at $Proxy3.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:86)
at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.remote.internal.MethodInvocationUnmarshallingDispatch.dispatch(MethodInvocationUnmarshallingDispatch.java:48)
at org.gradle.messaging.dispatch.DiscardOnFailureDispatch.dispatch(DiscardOnFailureDispatch.java:31)
at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:129)
at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:69)
at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 2 months