[Hibernate-JIRA] Created: (HHH-2215) Calling Session.connection() generates java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
by Nicklas Nordborg (JIRA)
Calling Session.connection() generates java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
----------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2215
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2215
Project: Hibernate3
Type: Bug
Versions: 3.2.1
Environment: Hibernate checked out from trunk; revision 10717
Reporter: Nicklas Nordborg
Attachments: Test case.zip
Calling Session.connection() always generates an exception. Here is the stacktrace I get from the attached test case:
Exception in thread "main" java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at org.hibernate.jdbc.BorrowedConnectionProxy.generateProxy(BorrowedConnectionProxy.java:56)
at org.hibernate.jdbc.ConnectionManager.borrowConnection(ConnectionManager.java:163)
at org.hibernate.jdbc.JDBCContext.borrowConnection(JDBCContext.java:111)
at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:359)
at TestSession.main(TestSession.java:16)
Changing the Connection.class.getClassLoader() to BorrowedConnectionProxy.class.getClassLoader() on line 57 in the generateProxy() method solves the problem. I am not very familiar with class loaders so I don't know if this is likeley to cause other problems elsewhere. Removing the ConnectionWrapper.class from the PROXY_INTERFACES array in the org.hibernate.jdbc.BorrowedConnectionProxy also solves the problem, but I guess it was added for a reason.
--
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
17 years, 10 months
[Hibernate-JIRA] Commented: (HHH-1528) GenericJDBCException when querying on one-to-one association
by Rob Hasselbaum (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528?page=c... ]
Rob Hasselbaum commented on HHH-1528:
-------------------------------------
This affects the Criteria API as well. In both cases, a workaround is to filter on the ID property of the associated object rather than the object itself. Modifying the code above, for example:
Query q = sess.createQuery("from Person p where p.name.id = :nameId");
q.setParameter("nameId", n.getId());
List result = q.list(); // WORKS!
> GenericJDBCException when querying on one-to-one association
> ------------------------------------------------------------
>
> Key: HHH-1528
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528
> Project: Hibernate3
> Type: Bug
> 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
17 years, 10 months
[Hibernate-JIRA] Commented: (HHH-1697) OracleDialect fails to recognize sequence accessible through syonyms when validating schema
by Vlad Skarzhevskyy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697?page=c... ]
Vlad Skarzhevskyy commented on HHH-1697:
----------------------------------------
Actual after consulting with our DBA I suggest this SQL to get the list of sequences!
SELECT sequence_name
FROM user_sequences
UNION
SELECT synonym_name
FROM user_synonyms us
WHERE EXISTS (
SELECT 1
FROM all_sequences asq
WHERE asq.sequence_name = us.table_name
AND asq.sequence_owner = us.table_owner )
Statement check the object owner is the same as a table owner in the synonyms. (to eliminate the case when the sequence is decalred under the owner different from these in the synonym declaration).
public String getQuerySequencesString() {
return
"SELECT sequence_name "
+ " FROM user_sequences "
+ "UNION "
+ "SELECT synonym_name "
+ " FROM user_synonyms us "
+ "WHERE EXISTS ( "
+ " SELECT 1 "
+ " FROM all_sequences asq "
+ " WHERE asq.sequence_name = us.table_name"
+ " AND asq.sequence_owner = us.table_owner)";
}
> OracleDialect fails to recognize sequence accessible through syonyms when validating schema
> -------------------------------------------------------------------------------------------
>
> Key: HHH-1697
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697
> Project: Hibernate3
> Type: Bug
> Environment: Hibernate 3.1.2, Hibernate 3.1.3 Oracle 10g
> Reporter: Bjørn Bjerkeli
> Priority: Minor
> Attachments: Oracle9Dialect.java
>
>
> The Dialect implementations in OracleDialect and Oracle9Dialect fails to recognize sequences upon validation when they are accesssed through synonyms
> because the user_sequences table will not create when the sequence is acced through a synonym. This is needed when using hibernate.hbm2ddl.auto=validate
> which is a very useful feature.
> Thus sequences returned by:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences";
> }
> will mot identify sequences accessible using a synonym.
> By using this implementation:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences " +
> "union " +
> "select synonym_name from user_synonyms us " +
> "where exists (select 1 from all_objects ao where object_type='SEQUENCE' and " +
> "us.table_name = ao.object_name)";
> }
> orale will also return sequences acccessible though synonyms.
--
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
17 years, 10 months
[Hibernate-JIRA] Commented: (HHH-1697) OracleDialect fails to recognize sequence accessible through syonyms when validating schema
by Vlad Skarzhevskyy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697?page=c... ]
Vlad Skarzhevskyy commented on HHH-1697:
----------------------------------------
I had the same problem.
Our production database connection looks to synonyms of tables and sequences.
My solution was to Extend the Oracle9Dialect class and set hibernate.dialect in config.
In hibernate.cfg.xml
hibernate.dialect=myapp.persistence.Oracle9fixedDialect
And the java file
package myapp.persistence;
import org.hibernate.dialect.Oracle9Dialect;
/**
* Fix the problem with hibernate.hbm2ddl.auto=validate
* When connecting to read only schema.
*/
public class Oracle9fixedDialect extends Oracle9Dialect {
public Oracle9fixedDialect() {
super();
}
public String getQuerySequencesString() {
return "select sequence_name from user_sequences "
+ "union "
+ "select synonym_name from user_synonyms us "
+ "where exists (select 1 from all_objects ao where object_type='SEQUENCE' and "
+ "us.table_name = ao.object_name)";
}
}
> OracleDialect fails to recognize sequence accessible through syonyms when validating schema
> -------------------------------------------------------------------------------------------
>
> Key: HHH-1697
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697
> Project: Hibernate3
> Type: Bug
> Environment: Hibernate 3.1.2, Hibernate 3.1.3 Oracle 10g
> Reporter: Bjørn Bjerkeli
> Priority: Minor
> Attachments: Oracle9Dialect.java
>
>
> The Dialect implementations in OracleDialect and Oracle9Dialect fails to recognize sequences upon validation when they are accesssed through synonyms
> because the user_sequences table will not create when the sequence is acced through a synonym. This is needed when using hibernate.hbm2ddl.auto=validate
> which is a very useful feature.
> Thus sequences returned by:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences";
> }
> will mot identify sequences accessible using a synonym.
> By using this implementation:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences " +
> "union " +
> "select synonym_name from user_synonyms us " +
> "where exists (select 1 from all_objects ao where object_type='SEQUENCE' and " +
> "us.table_name = ao.object_name)";
> }
> orale will also return sequences acccessible though synonyms.
--
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
17 years, 10 months
password encryption in hibernate
by kal stevens
I looked in "Java Persistence with Hibernate" and could not find the answer
to this question so I thought I would try here.
Is there a standard way to handle a user password in hibernate?
I want it to be encrypted, but it would be nice if there was a
@Password(strategy=Encryption.SHA) tag.
So I was just wondering if there was a standard way to get hibernate to
handle this for me.
Thanks
Kal
17 years, 10 months
[Hibernate-JIRA] Moved: (HHH-2408) Incorrect SQL generated for JPA QL Update statement involving multiple entities
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2408?page=all ]
Emmanuel Bernard moved EJB-265 to HHH-2408:
-------------------------------------------
Project: Hibernate3 (was: Hibernate Entity Manager)
Key: HHH-2408 (was: EJB-265)
Version: 3.2.1
(was: 3.2.1)
> Incorrect SQL generated for JPA QL Update statement involving multiple entities
> -------------------------------------------------------------------------------
>
> Key: HHH-2408
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2408
> Project: Hibernate3
> Type: Bug
> Versions: 3.2.2
> Environment: Hibernate 3.2.2 GA, Oracle 9i
> Reporter: Alex Savitsky
> Attachments: Branch.java, Issue.java, PersistentEntity.java, TestCase.zip, Visit.java, application.properties, log.txt
>
>
> When generating SQL for statements like this: UPDATE Issue i SET i.dueDate = i.dueDate + 10 WHERE i.visit.branch.id = :branchId, an extra comma is generated at the end of table list: update Issue, set DUE_DATE=DUE_DATE+10 where BRANCH_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
17 years, 10 months
[Hibernate-JIRA] Commented: (HHH-1528) GenericJDBCException when querying on one-to-one association
by Rob Hasselbaum (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528?page=c... ]
Rob Hasselbaum commented on HHH-1528:
-------------------------------------
Still a problem in Hibernate 3.2.2. There is no binding for the ID parameter in the PreparedStatement because of the empty OneToOneType.nullSafeSet method. Appears to have been implemented that way on purpose, but I don't know why. Here's the example I've been working with:
public class Person {
private Long m_id;
private Name m_name;
// ... getters and setters not shown ...
}
public class Name {
private Long m_id;
private Person m_person;
// ... getters and setters not shown ...
}
Mapped as follows:
<class name="Person" table="tbl_person">
<id name='id' column='objid'>
<generator class='native' />
</id>
<one-to-one name="name" class="Name" property-ref="person" cascade="all"/>
</class>
<class name="Name" table="tbl_name">
<id name='id' column='objid'>
<generator class='native' />
</id>
<many-to-one name="person" class="Person" column="person_id" not-null="true" unique="true"/>
</class>
The following code should work, but doesn't:
Person p = new Person();
Name n = new Name();
p.setName(n);
Session sess = getSessionFactory().getCurrentSession();
sess.save(p);
sess.flush();
sess.clear();
Query q = sess.createQuery("from Person p where p.name = :name");
q.setParameter("name", n);
List result = q.list(); // FAILS!
> GenericJDBCException when querying on one-to-one association
> ------------------------------------------------------------
>
> Key: HHH-1528
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1528
> Project: Hibernate3
> Type: Bug
> 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
17 years, 10 months