[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528?page=c...
]
Arne Limburg commented on HHH-1528:
-----------------------------------
I guess the empty implementation of nullSaveSet(...) has to do with insertion of (in your
example) Persons. On insertion no id for the name has to be set because of the primary key
join-column. However I get thi9s error, too, when using another join-column than the
primary key. I guess on the OneToOneType should be used on insertion and the ManyToOneType
on selection.
GenericJDBCException when querying on one-to-one association
------------------------------------------------------------
Key: HHH-1528
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.1.2
Environment: Hibernate 3.1.2, MySQL 4.1, Java 5
Reporter: Alexander Dvorkovyy
Attachments: src.zip
I am getting following stack trace:
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could
not execute query
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2148)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at BugDemo.main(BugDemo.java:28)
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
Caused by: java.sql.SQLException: Statement parameter 1 not set.
at
com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1031)
at
com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:676)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
... 13 more
while executing this code:
OneClass one = (OneClass) session.load(OneClass.class, 1L);
Query query = session.createQuery("FROM OneToOneClass oto WHERE
oto.whatever=:whatever");
query.setParameter("whatever", one);
query.list(); // < - - Exception is thrown here
on this domain model (I used annotations here, same thing with hbm.xml):
@Entity public class OneClass {
@Id private Long id;
}
@Entity public class OneToOneClass {
@Id private Long id;
@OneToOne
@PrimaryKeyJoinColumn
private OneClass whatever;
}
Problem first appeared in 3.1 (also when using xml mapping files), in 3.0 no problem.
Full source code attached.
Would be nice if the problem can be fixed in upcoming 3.1.3
--
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