[Hibernate-JIRA] Created: (ANN-598) Add ON clause to @ForeignKey
by Christian Bauer (JIRA)
Add ON clause to @ForeignKey
----------------------------
Key: ANN-598
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-598
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Reporter: Christian Bauer
More important than it sounds:
@org.hibernate.annotations.ForeignKey(name = "FK_FEED_DIRECTORY_ID")
I need ON CASCADE DELETE on many of my foreign keys, so I have to do this right now via:
<hibernate-mapping>
<database-object>
<create>
alter table FEED drop constraint FK_FEED_DIRECTORY_ID;
alter table FEED add constraint FK_FEED_DIRECTORY_ID foreign key (DIRECTORY_ID) references NODE on delete cascade;
</create>
<drop></drop>
</database-object>
</hibernate-mapping>
This is a bit annoying, especially since @JoinColumn(columnDefinition) is also not an option - I don't want to hardcode my HSQL datatypes.
So we should accept a parameter on @ForeignKey (I know that the Hibernate binder doesn't have that notion at all, we need it in native Hibernate as well) that accepts "[ON {DELETE | UPDATE} {CASCADE | SET DEFAULT | SET NULL}];" and does the right thing during schema export.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3903) instance not of expected entity type: java.util.HashMap is not a com.domian.Order_aud
by owais awan (JIRA)
instance not of expected entity type: java.util.HashMap is not a com.domian.Order_aud
--------------------------------------------------------------------------------------
Key: HHH-3903
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3903
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.2.0.cr2
Reporter: owais awan
at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3663)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1374)
at org.hibernate.id.Assigned.generate(Assigned.java:51)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.hibernate.envers.synchronization.work.ModWorkUnit.perform(ModWorkUnit.java:59)
at org.hibernate.envers.synchronization.AuditSync.executeInSession(AuditSync.java:126)
at org.hibernate.envers.synchronization.AuditSync.beforeCompletion(AuditSync.java:150)
at com.atomikos.icatch.jta.Sync2Sync.beforeCompletion(Sync2Sync.java:73)
at com.atomikos.icatch.imp.TransactionStateHandler.commit(TransactionStateHandler.java:253)
at com.atomikos.icatch.imp.CompositeTransactionImp.doCommit(CompositeTransactionImp.java:509)
at com.atomikos.icatch.imp.CompositeTerminatorImp.commit(CompositeTerminatorImp.java:138)
at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:297)
at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:608)
at com.atomikos.icatch.jta.UserTransactionManager.commit(UserTransactionManager.java:148)
at nz.co.smx.rest.TransactionFilter.afterHandle(TransactionFilter.java:224)
at org.restlet.Filter.handle(Filter.java:197)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Filter.doHandle(Filter.java:150)
at com.noelios.restlet.StatusFilter.doHandle(StatusFilter.java:130)
at org.restlet.Filter.handle(Filter.java:195)
at org.restlet.Filter.doHandle(Filter.java:150)
at org.restlet.Filter.handle(Filter.java:195)
at com.noelios.restlet.ChainHelper.handle(ChainHelper.java:124)
at com.noelios.restlet.application.ApplicationHelper.handle(ApplicationHelper.java:112)
at org.restlet.Application.handle(Application.java:341)
at org.restlet.ext.wadl.WadlApplication.handle(WadlApplication.java:705)
at org.restlet.Filter.doHandle(Filter.java:150)
My Order entity is a joined table inheritance based entity with three subclasses.
issue raise after using snapshot from Jboss "http://snapshots.jboss.org/maven2/org/hibernate/" repository.
--
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
15 years, 1 month
[Hibernate-JIRA] Commented: (HHH-892) HQL parser does not resolve alias in ORDER BY clause
by salvin francis (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-892?page=co... ]
salvin francis commented on HHH-892:
------------------------------------
I wonder why the usage of "col_0_0_" is considered 'normal' and not a hack
I feel that providing such solutions is not correct to any client.
I am using the CASE ...WHEN...END functionality in my system
My situation is that i am retrieving some values from a table in the form "Critical","High","Medium","Low"
in my case an Alphabetical sort would of couse screw it.
and there is No way my client would allow me to add an extra column in his DB
I would obviously deter from using a SQL query here as it would change my complete system approach already implemented in
> HQL parser does not resolve alias in ORDER BY clause
> -----------------------------------------------------
>
> Key: HHH-892
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-892
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, MySQL, Tomcat
> Reporter: Guido Laures
> Priority: Minor
>
> When using an alias for an ORDER BY clause this is not always correctly resolved. Example:
> SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY mySum
> does not work because "mySum" is not resolved in the ORDER BY clause which results in an exception telling that mySum is an unknown column.
> Workaround (not to say "hack") is using:
> SELECT SUM(A.x) AS mySum FROM MyClass AS A GROUP BY A.y ORDER BY col_0_0_
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3901) Problem to query with generated columns: Illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
by Debabrata Dey (JIRA)
Problem to query with generated columns: Illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3901
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3901
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4.sp1;
Database server = DB2/LINUXX8664 9.5.0
JDK: 1.5.0_14-b03
Reporter: Debabrata Dey
This issue occurs when upgrading to version 3.2.4_sp1. It works absolutely fine with version 3.2.1 <Three similar cases fail when using Hibernate version 3.2.4.sp1.
Error:
illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
org.hibernate.QueryException: illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:46)
at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:512)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:221)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:728)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.DAOImp.AgentDAOImp.findAgentByCriteria(AgentDAOImp.java:388)
Agent a has a roleSet defined like this -
private Set roleSet;
@ManyToMany(targetEntity = SecurityRole.class, cascade={}, fetch= FetchType.LAZY)
@JoinTable(name="AGENTROLE", joinColumns={@JoinColumn(name="AGENTID")}, inverseJoinColumns={@JoinColumn(name="SECURITYROLEID")})
public Set getRoleSet() {
return roleSet;
}
SecurityRole has attribute roleName_up which maps to a generated column value like this.
@Column(name="roleName_up", insertable=false, updatable=false)
@Generated(value = GenerationTime.ALWAYS)
public String getRoleName_up() {
return roleName_up;
}
--
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
15 years, 1 month