[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, 7 months
[Hibernate-JIRA] Created: (HHH-2882) QueryKey.equals() returning false with distributed caching
by Daniel Campagnoli (JIRA)
QueryKey.equals() returning false with distributed caching
----------------------------------------------------------
Key: HHH-2882
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2882
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.5
Reporter: Daniel Campagnoli
We noticed some issues recently with the query cache when using Coherence as the cache provider. This was due to instances of org.hibernate.cache.QueryKey not being equal after being serialized then deserialized.
The equals check was failing on the [ResultTransformer customTransformer] field which in our case had an instance of RootEntityResultTransformer (which comes from the field CriteriaSpecification.ROOT_ENTITY). This is because RootEntityResultTransformer doesnt override equals, so the check is done by reference equality. When the QueryKey has been serialized and deserialized out of the cache, the instance will always be different, so the equals check will fail.
A fix for this to be implement equals for RootEntityResultTransformer (and possibly the other ResultTransformer's). I used the following which worked fine.
public boolean equals(Object obj) {
return obj != null && this.getClass() == obj.getClass();
}
ps. I created HHH-1665 a while ago, a real simple fix, could that be looked at :)
--
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, 7 months
[Hibernate-JIRA] Created: (HHH-3035) could not read column value from result set: MEDFAC1_14_0_; Invalid column name SQL Error: 17006, SQLState: null
by sanjeev singh (JIRA)
could not read column value from result set: MEDFAC1_14_0_; Invalid column name SQL Error: 17006, SQLState: null
----------------------------------------------------------------------------------------------------------------
Key: HHH-3035
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3035
Project: Hibernate3
Issue Type: Bug
Components: core, query-criteria, query-hql, query-sql
Affects Versions: 3.2.2
Environment: JDK5 , Hibernate Junit Test case,WIndows XP
Reporter: sanjeev singh
The following is my section of hibernate mapping file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="gov.njdhss.hippocrates.ems.valueobjects">
<class name="HeprEmsMedfacFacilityVO" table="HEPR_MEDFAC">
<id name="medfacId" column="MEDFAC_ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">HEPR_MEDFAC_SEQ</param>
</generator>
</id>
<property name="medfacName" type="java.lang.String"
column="MEDFAC_NAME" update="true" insert="true">
</property>
<property name="facCode" type="java.lang.String"
column="FAC_CODE" update="true" insert="true">
</property>
</class>
<sql-query name="allfacility">
<return alias="facilities" class="HeprEmsMedfacFacilityVO" >
<return-property name="medfacName" column="MEDFAC_NAME"/>
</return>
<![CDATA[
select facilities.MEDFAC_NAME AS medfacName
from HEPR_MEDFAC facilities
]]>
</sql-query>
</hibernate-mapping>
I am trying to execute the query using the following client code:
public List getAllFacility() {
List listAllFacilities = null;
listAllFacilities = getHibernateTemplate().findByNamedQuery(
"allfacility");
return listAllFacilities;
}
The following is the error:
Hibernate:
select
facilities.MEDFAC_NAME AS medfacName
from
HEPR_MEDFAC facilities
- could not read column value from result set: MEDFAC1_14_0_; Invalid column name
- SQL Error: 17006, SQLState: null
- Invalid column name
- Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
- SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
Any idea if it is a bug or there is any error in my code.
--
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, 7 months
[Hibernate-JIRA] Created: (ANN-554) NPE with @Id on @OneToOne
by Loïc Minier (JIRA)
NPE with @Id on @OneToOne
-------------------------
Key: ANN-554
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-554
Project: Hibernate Annotations
Type: Bug
Versions: 3.2.1
Environment: Hibernate 3.2.2 GA, Hibernate Annotations 3.2.1, J2SE 1.6.0-b105 on Debian GNU/Linux sid, PostgreSQL 7.4
Reporter: Loïc Minier
Priority: Minor
Hi,
(Note: I originally reported this on the forum, but the lack of response suggests this might be a bug in Hibernate Annotations or Hibernate; the forum topic is at: http://forum.hibernate.org/viewtopic.php?t=970823)
I hope it's not a misuse of Hibernate, but I'm trying to use @Id on @OneToOne, and this causes the following NPE when running hbm2ddl:
java.lang.NullPointerException
at org.hibernate.util.StringHelper.qualify(StringHelper.java:264)
at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:196)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:56)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:287)
at org.hibernate.tool.ant.Hbm2DDLExporterTask.execute(Hbm2DDLExporterTask.java:45)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:171)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
What I'm trying to do at the application level is:
Foo class and table
long foo_id, primary key
FooData fooData, nulllable=true
FooData class and table
foo_id references Foo(foo_id), nullable=false
This is expressed in Java as:
@Entity
@Table(name = "foo")
public class Foo {
@Id @GeneratedValue
@Column(name = "foo_id")
Long id;
@OneToOne(mappedBy = "foo", cascade = CascadeType.ALL)
FooData fooData;
...
@Entity
@Table(name = "foo_data")
public class FooData {
@Id
@OneToOne
@JoinColumn(name = "foo_id", nullable = false)
Foo foo;
This causes a NPE here.
If I use a real Id on FooData, e.g.:
@Id
@Column(name = "foo_data_id")
Long id;
it works, and I end up with:
- foo_id in table foo as a primary key
- foo_data_id in table foo_data as a primary key
- foo_id in table foo_data not null
- foo_id in table foo_data references foo_id in table foo
I don't want a foo_data_id, I don't need it, hence the lack of it which leads to the NPE.
Bye,
--
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, 7 months