[Hibernate-JIRA] Created: (HHH-6920) Jboss7 with Insert into select query
by sabbirali kadiwala (JIRA)
Jboss7 with Insert into select query
------------------------------------
Key: HHH-6920
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6920
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final
Environment: I am using jboss-as-7.0.2.Final, its using hibernate 4.x. I am using oracle 10g as database.
Reporter: sabbirali kadiwala
In my application we used "insert into select" query for improve performance which is running fine in jboss6.
But
with jboss7 it is giving error as below
ErrorMessage:
javax.ejb.EJBTransactionRolledbackException: org.hibernate.QueryException: can only generate ids as part of bulk insert with either sequence or post-insert style generators [insert into ScheduleDetails(mstSchedule,articleCode,vendorCode,valuationClass,ruleClass) select ts.mstSchedule,ma.id.articleCode,tg.vendorCode,tg.valuationClass,'O' from com.eks.ias.service.core.entity.TransGp tg, com.eks.ias.service.core.entity.MstArticle ma,com.eks.ias.service.schedule.entity.TransSchedule ts where ts.id.scheduleReferenceId = :scheduleRefId and tg.id.siteCode = :siteCode and ma.isDeleted=false and tg.id.articleCode=ma.id.articleCode and tg.id.siteCode = ts.mstSchedule.mstSite.siteCode and ts.mstSchedule.mstSite.sapVersion = ma.id.sapVersion and ma.mstMc.mcCode = ts.id.mcCode ]
and entity looks like
@Entity
@Table(name = "SCHEDULE_DETAILS")
@SequenceGenerator(name = "SCHEDULE_DETAILS_ID_GENERATOR", sequenceName = "MST_SCHEDULE_DETAILS_ID_SEQ", initialValue = 1, allocationSize = 1)
public class ScheduleDetails implements java.io.Serializable
{
private Long scheduleDetailsId;
private MstSchedule mstSchedule;
.....
// we have some constructor also
...
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SCHEDULE_DETAILS_ID_GENERATOR")
@Column(name = "SCHEDULE_DETAILS_ID", unique = true, nullable = false, precision = 38, scale = 0)
public Long getScheduleDetailsId() {
return this.scheduleDetailsId;
}
>From Jboss7 Community i got below reply
@GeneratedValue(SEQUENCE) maps to org.hibernate.id.enhanced.SequenceStyleGenerator, which isn't checked for in org.hibernate.hql.internal.ast.HqlSqlWalker.supportsIdGenWithBulkInsertion().
As previously discussed here, hibernate.id.new_generator_mappings is set to true by default, and as a result, class SequenceStyleGenerator is used instead of class SequenceHiLoGenerator (which is checked for in the above supportsIdGenWithBulkInsertion).
Could you create a Hibernate (against 4.0.0.Final) jira for this bug, the link is here.
Please reply when it got resolved and in which version..
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-6871) SingletonEhCacheProvider shoud not shutdown singleton CacheManager if it doesn't own it
by Adrien (JIRA)
SingletonEhCacheProvider shoud not shutdown singleton CacheManager if it doesn't own it
---------------------------------------------------------------------------------------
Key: HHH-6871
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6871
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 4.0.0.CR7, 3.6.8
Reporter: Adrien
Priority: Minor
SingletonEhCacheProvider use a static referenceCount every time a sessionFactory wants a CacheManager, and shutdown it when all sessionFactories are gone. But Hibernate may not be the only one using it. In our case, we have manual configuration of the CacheManager singleton and cache regions not managed by Hibernate. The simple fact of creating a SessionFactory, then close it shutdown the singleton, with our configuration and cache regions.
It's hard to know if Hibernate is the only one using EhCache and it's cool that Hibernate close the EhCache threads for most configurations, but in our case, it's a real problem. We manually call new SingletonEhCacheProvider().start(null) to increment the referenceCount, but others will have the problem.
My proposition is that before accessing for the first time to the CacheManager (referenceCount, Hibernate check if it's already exist (meaning it's already been used by someoneelse). If so, it increment the referenceCount to be sure Hibernate will never shutdown the CacheManager. Something like :
public void start(Settings settings, Properties properties) throws CacheException {
(...)
if (referenceCount.get() == 0 && CacheManager.getCacheManager(null) != null) {
REFERENCE_COUNT.incrementAndGet();
}
(...)
}
There may be some multi-thread issues with this code, but it's just the idea.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Resolved: (HHH-1870) org.hibernate.TransientObjectException: object references an unsaved transient
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870?page=c... ]
Steve Ebersole resolved HHH-1870.
---------------------------------
Resolution: Fixed
Fix Version/s: (was: 4.0.1)
4.1.0
> org.hibernate.TransientObjectException: object references an unsaved transient
> -------------------------------------------------------------------------------
>
> Key: HHH-1870
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870
> Project: Hibernate Core
> Issue Type: Bug
> Environment: Hibernate 3.2.0 RC 2 from SVN tunk 2006/06/30
> Reporter: Sergey Vladimirov
> Assignee: Gail Badner
> Fix For: 4.1.0
>
> Attachments: manytoonelazy.zip, patch.txt
>
>
> JUnit test case shows strange error on commit():
> Session session = sessionFactory.openSession();
> Transaction transaction = session.beginTransaction();
> BeanB beanB = new BeanB();
> beanB.setId(1);
> session.save(beanB);
> beanB = (BeanB) session.load(BeanB.class, 1);
> BeanA beanA = new BeanA();
> beanA.setId(2);
> beanA.setParent((BeanB) session.load(BeanB.class, 1));
> session.save(beanA);
> transaction.commit();
> session.close();
> org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ru.arptek.arpsite.data.manytoonelazy.BeanA.parent -> ru.arptek.arpsite.data.manytoonelazy.BeanB
> at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:273)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:257)
> at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
> at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
> at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:135)
> at ru.arptek.arpsite.data.manytoonelazy.TestWithoutCache.testFind(TestWithoutCache.java:57)
> 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:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Temporary patch included. May be it is brokes other issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Commented: (HHH-1870) org.hibernate.TransientObjectException: object references an unsaved transient
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870?page=c... ]
Steve Ebersole commented on HHH-1870:
-------------------------------------
Isn't this issue "fixed by" HHH-5472?
> org.hibernate.TransientObjectException: object references an unsaved transient
> -------------------------------------------------------------------------------
>
> Key: HHH-1870
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870
> Project: Hibernate Core
> Issue Type: Bug
> Environment: Hibernate 3.2.0 RC 2 from SVN tunk 2006/06/30
> Reporter: Sergey Vladimirov
> Assignee: Gail Badner
> Fix For: 4.0.1
>
> Attachments: manytoonelazy.zip, patch.txt
>
>
> JUnit test case shows strange error on commit():
> Session session = sessionFactory.openSession();
> Transaction transaction = session.beginTransaction();
> BeanB beanB = new BeanB();
> beanB.setId(1);
> session.save(beanB);
> beanB = (BeanB) session.load(BeanB.class, 1);
> BeanA beanA = new BeanA();
> beanA.setId(2);
> beanA.setParent((BeanB) session.load(BeanB.class, 1));
> session.save(beanA);
> transaction.commit();
> session.close();
> org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ru.arptek.arpsite.data.manytoonelazy.BeanA.parent -> ru.arptek.arpsite.data.manytoonelazy.BeanB
> at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:273)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:257)
> at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
> at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
> at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:135)
> at ru.arptek.arpsite.data.manytoonelazy.TestWithoutCache.testFind(TestWithoutCache.java:57)
> 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:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> Temporary patch included. May be it is brokes other issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-6943) hbm with xsd is not working
by nick (JIRA)
hbm with xsd is not working
---------------------------
Key: HHH-6943
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6943
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final
Environment: Hibernate 4.0.0 Final + JBoss AS 7 + PostgreSQL
Reporter: nick
Priority: Critical
Attachments: Accountdetailkey.hbm.xml
While using any of the following xsd in hbm.xml
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping http://www.hibernate.org/xsd/hibernate-mapping/hibernate-mapping-4.0.xsd">
Or
<hibernate-mapping xmlns="http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd">
or
<hh:hibernate-mapping xmlns:hh="http://www.hibernate.org/xsd/hibernate-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-mapping hibernate-mapping-4.0.xsd">
Its throwing the following error
Caused by: java.lang.NullPointerException
at org.hibernate.metamodel.source.hbm.ColumnSourceImpl.isUnique(ColumnSourceImpl.java:109) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.makeColumn(Binder.java:1091) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.bindRelationalValues(Binder.java:1023) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.doBasicSingularAttributeBindingCreation(Binder.java:747) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.bindSimpleIdentifier(Binder.java:331) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.bindIdentifier(Binder.java:314) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.makeRootEntityBinding(Binder.java:183) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.createBasicEntityBinding(Binder.java:159) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.doCreateEntityBinding(Binder.java:147) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.createEntityBinding(Binder.java:132) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.binder.Binder.processEntityHierarchy(Binder.java:108) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.hbm.HbmMetadataSourceProcessorImpl.processMappingMetadata(HbmMetadataSourceProcessorImpl.java:88) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.internal.MetadataImpl.bindMappingMetadata(MetadataImpl.java:195) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.internal.MetadataImpl.<init>(MetadataImpl.java:165) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.source.internal.MetadataBuilderImpl.buildMetadata(MetadataBuilderImpl.java:83) [hibernate-core-4.0.0.Final.jar:]
at org.hibernate.metamodel.MetadataSources.buildMetadata(MetadataSources.java:112) [hibernate-core-4.0.0.Final.jar:]
I'm attaching one of my hbm file which creating this error.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HSEARCH-1011) Unable to load entities with composite id using HSQLDB
by Baptiste MATHUS (JIRA)
Unable to load entities with composite id using HSQLDB
------------------------------------------------------
Key: HSEARCH-1011
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-1011
Project: Hibernate Search
Issue Type: Bug
Affects Versions: 3.1.1.GA
Environment: HSQLDB 1.8.0.2
Reporter: Baptiste MATHUS
Hi,
Hibernate Search actually manages to find entries in the lucene index, but then it fails trying to load them.
In fact, this issue seems to boil down to HSQLDB not supporting a query of this kind "...where (a,b) in (('x','y'))".
{{Caused by: java.sql.SQLException: Unexpected token: , in statement}}
This issue doesn't appear with Oracle, which is our production database. But it prevents us from unit/integration testing our code (using Arquillian/hsqldb/dbunit), which is in fact not very cool.
After that [discussion on the forum|https://forum.hibernate.org/viewtopic.php?f=9&t=1013645&sid=3f56cef...], I've taken some time to create a test project (I'll host in a dedicated github repository, actually).
As explained on the forum, I guess I'm stuck using 3.1.1.GA, since we're using JBoss EAP 5.x.
Do you think that could be fixed?
If you give me pointers so that I can see if I can propose a patch, would it even be possible to release a 3.x version of hsearch?
Thanks for your answers.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-5257) @JoinTable results in redundant join in the generated SQL
by Sharath Reddy (JIRA)
@JoinTable results in redundant join in the generated SQL
---------------------------------------------------------
Key: HHH-5257
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5257
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.2
Reporter: Sharath Reddy
Priority: Minor
Fix For: 3.6
Attachments: testcase.zip
An Account can have several Clients:
@Entity
@Table(name = "CLIENT")
public class Client implements Serializable {
private String street;
private String code;
private String city;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@ManyToOne
@JoinTable(name = "CLIENT_ACCOUNT",
joinColumns = {@JoinColumn(name = "FK_CLIENT", referencedColumnName = "ID")},
inverseJoinColumns = {@JoinColumn(name = "FK_ACCOUNT", referencedColumnName = "ID")})
private Account account;
.....
}
@Entity
@Table(name = "ACCOUNT")
public class Account implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String number;
private double balance;
@OneToMany (fetch = FetchType.EAGER, mappedBy="account")
private Set<Client> holders;
...
}
When we load the Account entity:
Account a1 = (Account) session.load(Account.class, accountId);
We see that there is a redundant join at the end - from the CLIENT table to the CLIENT_ACCOUNT table:
select
account0_.id as id2_1_,
account0_.balance as balance2_1_,
account0_.number as number2_1_,
holders1_.FK_ACCOUNT as FK1_2_3_,
client2_.id as FK2_3_,
client2_.id as id0_0_,
client2_.city as city0_0_,
client2_.code as code0_0_,
client2_.street as street0_0_,
client2_1_.FK_ACCOUNT as FK1_1_0_
from
ACCOUNT account0_
left outer join
CLIENT_ACCOUNT holders1_
on account0_.id=holders1_.FK_ACCOUNT
left outer join
CLIENT client2_
on holders1_.FK_CLIENT=client2_.id
left outer join
CLIENT_ACCOUNT client2_1_
on client2_.id=client2_1_.FK_CLIENT
where
account0_.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, 12 months