[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-6920) HQL insert queries and identifier handling
Steve Ebersole (JIRA)
noreply at atlassian.com
Wed Jan 11 13:13:11 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HHH-6920.
-------------------------------
Prepping 4.0.1
> HQL insert queries and identifier handling
> ------------------------------------------
>
> 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
> Assignee: Steve Ebersole
> Fix For: 4.0.1
>
> Time Spent: 1h 8m
>
> 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
More information about the hibernate-issues
mailing list