[Hibernate-JIRA] Created: (HHH-3620) Oracle - testWithClause fails due to "Missing IN or OUT parameter at index:: 1"
by Juraci Paixao Krohling (JIRA)
Oracle - testWithClause fails due to "Missing IN or OUT parameter at index:: 1"
-------------------------------------------------------------------------------
Key: HHH-3620
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3620
Project: Hibernate Core
Issue Type: Bug
Components: testsuite
Affects Versions: 3.3.x
Environment: Oracle 9i, Branch_3_3
Reporter: Juraci Paixao Krohling
Test testWithClause (org.hibernate.test.hql.WithClauseTest) fails due to "Missing IN or OUT parameter at index:: 1"
Stack trace:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2231)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:364)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.test.hql.WithClauseTest.testWithClause(WithClauseTest.java:112)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at org.hibernate.junit.functional.FunctionalTestCase.runTest(FunctionalTestCase.java:125)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.hibernate.junit.UnitTestCase.runBare(UnitTestCase.java:63)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at org.hibernate.junit.functional.FunctionalTestClassTestSuite.runTest(FunctionalTestClassTestSuite.java:115)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.hibernate.junit.functional.FunctionalTestClassTestSuite.run(FunctionalTestClassTestSuite.java:84)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.SQLException: Missing IN or OUT parameter at index:: 1
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1711)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3311)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3361)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
... 31 more
--
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, 8 months
[Hibernate-JIRA] Created: (EJB-381) EntityManager doesn't care about INSERT trigger of Oracle XE
by Juergen Zimmermann (JIRA)
EntityManager doesn't care about INSERT trigger of Oracle XE
------------------------------------------------------------
Key: EJB-381
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-381
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Hibernate EM 3.4.0, Hibernate Annotations 3.4.0, Hibernate Commons Annotations 3.1.0, Hibernate 3.3.0.SP1, Hibernate Validator 3.1.0.CR2, JDK 1.6.0_07
Reporter: Juergen Zimmermann
I have an abstract entity class with 2 derived concrete classes:
@Entity
@Table(name="kunde")
@Inheritance
@DiscriminatorColumn(name="art", length=1)
@XmlRootElement
@XmlSeeAlso({
Firmenkunde.class,
Privatkunde.class
})
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Kunde implements java.io.Serializable {
@Id
@GeneratedValue(generator="kunde_sequence_name")
@SequenceGenerator(name="kunde_sequence_name", sequenceName="kunde_k_id_seq", allocationSize=1)
@Column(name="k_id", nullable=false)
@XmlAttribute(name="id", required=true)
protected Long id = KEINE_ID;
@Version
@XmlTransient
protected int version = ERSTE_VERSION;
@Column(length=32, nullable=false)
@XmlElement(required=true)
protected String nachname = "";
...
@Column(length=32, unique=true)
protected String username = "";
...
}
The table is created as follows:
CREATE TABLE kunde(
k_id NUMBER(16) NOT NULL PRIMARY KEY,
version NUMBER(8) DEFAULT 0,
nachname VARCHAR2(32) NOT NULL,
...
art VARCHAR2(2) DEFAULT 'P',
...
username VARCHAR2(32) NOT NULL UNIQUE,
...
);
Additionally there is this sequence and insert trigger for column username.
CREATE SEQUENCE kunde_k_id_seq START WITH 200 NOMAXVALUE
/
CREATE OR REPLACE TRIGGER kunde_trigger_insert
BEFORE INSERT ON kunde
FOR EACH ROW
BEGIN
:NEW.username := TO_CHAR(:NEW.k_id);
END;
/
New objects are inserted into the database using this code which works fine with PostgreSQL. However, using Oracle XE the insert trigger isn't considered:
public List<Kunde> insertKunden(List<Kunde> kunden) {
if (kunden == null || kunden.isEmpty()) {
return new ArrayList<Kunde>(0);
}
for (Kunde k: kunden) {
em.persist(k);
}
return kunden;
}
The attribute "username" is null using Oracle XE, but using PostgreSQL it has the value produced by the INSERT trigger.
--
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, 8 months
[Hibernate-JIRA] Created: (EJB-337) Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
by valery gorbunov (JIRA)
Entity scaning failing when path protocol is "file:" (not jar) and it contains spaces
-------------------------------------------------------------------------------------
Key: EJB-337
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-337
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.3.1.GA
Environment: OS Linux
Hibernate 3.2.5ga
HiberanteEM -3.3.1ga
Reporter: valery gorbunov
Priority: Critical
Entity scanning failed when path contains spaces
Stack trace is:
java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:74)
at org.jboss.util.file.FileProtocolArchiveBrowserFactory.create(FileProtocolArchiveBrowserFactory.java:48)
at org.jboss.util.file.FileProtocolArchiveBrowserFactoryTest.testCreate(FileProtocolArchiveBrowserFactoryTest.java:29)
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:597)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.jar.JarFile.<init>(JarFile.java:133)
at java.util.jar.JarFile.<init>(JarFile.java:97)
at org.jboss.util.file.JarArchiveBrowser.<init>(JarArchiveBrowser.java:69)
... 24 more
Problem in FileProtocolArchiveBrowserFactory class
see test:
package org.jboss.util.file;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import junit.framework.Assert;
import org.junit.Test;
/**
*
* @author Valery Gorbunov <a href=mailto:vgorbunov@comodo.com.ua>vgorbunov(a)comodo.com.ua</a>
*/
public class FileProtocolArchiveBrowserFactoryTest {
@Test
public void testCreate() throws MalformedURLException, URISyntaxException {
URI uri = new URI("file:/tmp/Path%20with%20space");
File f = new File(uri);
if (!f.exists()) {
Assert.assertTrue(f.mkdir());
}
FileProtocolArchiveBrowserFactory factory = new FileProtocolArchiveBrowserFactory();
Object ab = factory.create(f.toURI().toURL(), null);
assertNotNull(ab);
assertTrue(ab instanceof DirectoryArchiveBrowser);
}
}
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-2782) Component getType caches the type value
by Kiss Zoltán (JIRA)
Component getType caches the type value
---------------------------------------
Key: HHH-2782
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: all
Reporter: Kiss Zoltán
Component class caches the value of the type attribute:
public Type getType() throws MappingException {
// added this caching as I noticed that getType() is being called multiple times...
if ( type == null ) {
type = buildType();
}
return type;
}
This forbids the use of 'dynamic attributes'.
For eg. if you try to add new properties to an existing dynamic-component with the addProperty method, then the rebuild of the session factory will failed, because the Component property will be invalid during the validation (in the Component there will be a different column span value, then in the cached ComponentType).
There should be a method like this in the Component class:
public void rebuildType() {
type = buildType();
}
With the help of this the type could be rebuild if it is necessary.
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-3128) NullPointerException while building SessionFactory when using native sql query for loading many-to-many mapped collections
by Juergen Denzel (JIRA)
NullPointerException while building SessionFactory when using native sql query for loading many-to-many mapped collections
--------------------------------------------------------------------------------------------------------------------------
Key: HHH-3128
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3128
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6, 3.2.5
Environment: Hibernate 3.2.6
Reporter: Juergen Denzel
Attachments: src.zip
Hi,
I am trying to load a many-to-many mapped collection using a sql query like this:
<sql-query name="loadItems">
<load-collection alias="item" role="test.Test.items"/>
select {item.*} from Items item where item.id = :id
</sql-query>
This always fails due to a NullPointerException:
java.lang.NullPointerException
at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182)
at org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135)
at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98)
at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:446)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:352)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
at test.HibernateTest.testSessionFactory(HibernateTest.java:18)
I provided a very simple TestCase + Mappings to illustrate the problem. The exception does not occur for one-to-many mappings.
Just for your information, we need this functionality in order to deal with DB2 problems we have.
I ran this TestCase against 3.2.5 and 3.2.6 and both failed.
Thanks.
Juergen Denzel
--
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, 8 months
[Hibernate-JIRA] Created: (HHH-3148) Exception thrown by debug trace code: ComponentType toLoggableString
by Pete Geraghty (JIRA)
Exception thrown by debug trace code: ComponentType toLoggableString
--------------------------------------------------------------------
Key: HHH-3148
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3148
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6.ga
HibernateAnnotations 3.3.0.ga
Oracle 10g Express Edition
Reporter: Pete Geraghty
Priority: Minor
Attachments: ToLoggableStringExample.txt
The method toLoggableString in ComponentType is used to provide tracing output when running with log level DEBUG. In some circumstances it throws a ClassCastException.
This is not a good idea in tracing code and obscures underlying problems.
In my case the underlying problem was a previous incorrect call to set a parameter value in a query. I saw that previous JIRA issues have mentioned this ClassCastException as a side effect of other underlying problems - it is a distraction and time-waster.
Lines 375-378 read:
EntityMode entityMode = tuplizerMapping.guessEntityMode( value );
if ( entityMode == null ) {
throw new ClassCastException( value.getClass().getName() );
}
A better solution would be to just us String.valueOf
EntityMode entityMode = tuplizerMapping.guessEntityMode( value );
if ( entityMode == null ) {
return String.valueOf(value);
}
Another possibility would be to concatenate some diagnostic message with String.valueOf, but personally I don't think that be helpful.
Stack trace is:
Exception in thread "main" java.lang.ClassCastException: java.lang.String
at org.hibernate.type.ComponentType.toLoggableString(ComponentType.java:377)
at org.hibernate.pretty.Printer.toString(Printer.java:76)
at org.hibernate.engine.QueryParameters.traceParameters(QueryParameters.java:277)
at org.hibernate.engine.query.HQLQueryPlan.performIterate(HQLQueryPlan.java:210)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1192)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:46)
at hib.example.EntityWithEmbeddable.main(EntityWithEmbeddable.java:44)
Example code for the classes and schema to reproduce is pasted into the attachment.
--
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, 8 months