[Hibernate-JIRA] Created: (HHH-6956) Unknown Parameter: Unknown Coloumname MyColoumn ERRORCODE=-4460, SQLSTATE=null by entityManager.createNativeQuery
by Thomas Krippner (JIRA)
Unknown Parameter: Unknown Coloumname MyColoumn ERRORCODE=-4460, SQLSTATE=null by entityManager.createNativeQuery
-----------------------------------------------------------------------------------------------------------------
Key: HHH-6956
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6956
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.9
Environment: - JDK 1.6
- WebSphere 7.0 (Windows and zLinux)
- Hibernate 3.6.9-Final
- DB2 OS / 390
Reporter: Thomas Krippner
Priority: Critical
If I make a native Query to DB2 with org.hibernate.dialect.DB2390Dialect dialect the org.hibernate.loader.custom.CustomLoader.Metadata Class search the Result Column Names in the Lable Column and not in Columnname.
Problem is Cant make native Queries on Tables with "Label" description.
In line 579 in org.hibernate.loader.custom.CustomLoader is :
return factory.getDialect().getColumnAliasExtractor().extractColumnAlias( resultSetMetaData, position );
The dialect Class is now org.hibernate.dialect.Dialect. At Line 1696 the Extractor gets the Label Extractor to the CustomLoader.
public ColumnAliasExtractor getColumnAliasExtractor() {
return ColumnAliasExtractor.COLUMN_LABEL_EXTRACTOR;
}
The effect is now, that the extractor get the Label of Tabel as Coloumnname to the rowProcessor. And the JDBC ResultSet can't find the Column.
The ColumnAliasExtractor.COLUMN_NAME_EXTRACTOR is never used in this case and that is the Issue.
My Test:
Persistence.xml
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="TEST" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/DB2</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.ejb.cfgfile" value="db2_config.xml" />
</properties>
</persistence-unit>
</persistence>
db2_config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="current_session_context_class">jta</property>
<property name="dialect">org.hibernate.dialect.DB2390Dialect</property>
<property name="default_schema">SCHEMA</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="generate_statistics">true</property>
</session-factory>
</hibernate-configura
EntityManager entityManager = JPAUtil.getEntityManager("TEST");
Query query = entityManager.createNativeQuery("select * from MyTable");
List<Object> ts = (List<Object>) query.getResultList();
System.out.println(ts);
Database Definition is:
CREATE TABLE MyTable
(
ID DECIMAL(15) NOT NULL
,A DECIMAL(15) NOT NULL
,B INTEGER NOT NULL
,C INTEGER NOT NULL
,D DECIMAL(11, 8) NOT NULL
)
COMMENT ON TABLE MyTable
IS 'description';
LABEL ON TABLE MyTable
IS 'Description Two';
LABEL ON MyTable
(
ID IS 'My Column Description'
, A IS 'Description A'
, B IS 'Description B'
, C IS 'Description C'
, D IS 'Description D'
)
On My German System StackTrace
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10150][10300][3.62.56] Ungültiger Parameter: Unbekannter My Column Description. ERRORCODE=-4460, SQLSTATE=null
at com.ibm.db2.jcc.am.fd.a(fd.java:660)
at com.ibm.db2.jcc.am.fd.a(fd.java:60)
at com.ibm.db2.jcc.am.fd.a(fd.java:103)
at com.ibm.db2.jcc.am.hb.a(hb.java:1889)
at com.ibm.db2.jcc.am.ym.a(ym.java:1803)
at com.ibm.db2.jcc.am.ym.getShort(ym.java:1562)
at de.mypackage.basis.sql.ResultSet.getShort(ResultSet.java:825)
at org.hibernate.type.descriptor.sql.SmallIntTypeDescriptor$2.doExtract(SmallIntTypeDescriptor.java:61)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:235)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:505)
at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:451)
at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:348)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:639)
at org.hibernate.loader.Loader.doQuery(Loader.java:829)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HV-533) @Digits.fraction should allow negative values
by Devesh Parekh (JIRA)
@Digits.fraction should allow negative values
---------------------------------------------
Key: HV-533
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-533
Project: Hibernate Validator
Issue Type: Bug
Components: documentation, validators
Affects Versions: 4.2.0.Final
Reporter: Devesh Parekh
There are really two bugs here:
1. The documentation for @Digits.fraction does not concretely say what should happen for negative values, but the 1.0 final spec defines the correct behavior on page 133 with the equation @Column.precision = @Digits.integer + @Digits.fraction. This suggests that @Digits.fraction should be negative when @Column.scale is negative.
2. The implementation throws an IllegalArgumentException when @Digits.fraction is negative.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Updated: (HHH-1870) org.hibernate.TransientObjectException: object references an unsaved transient
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870?page=c... ]
Gail Badner updated HHH-1870:
-----------------------------
Fix Version/s: (was: 4.1.0)
4.0.1
> org.hibernate.TransientObjectException: object references an unsaved transient
> -------------------------------------------------------------------------------
>
> Key: HHH-1870
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1870
> Project: Hibernate Core
> Issue Type: Bug
> Environment: Hibernate 3.2.0 RC 2 from SVN tunk 2006/06/30
> Reporter: Sergey Vladimirov
> Assignee: Gail Badner
> Fix For: 4.0.1
>
> Attachments: manytoonelazy.zip, patch.txt
>
>
> JUnit test case shows strange error on commit():
> Session session = sessionFactory.openSession();
> Transaction transaction = session.beginTransaction();
> BeanB beanB = new BeanB();
> beanB.setId(1);
> session.save(beanB);
> beanB = (BeanB) session.load(BeanB.class, 1);
> BeanA beanA = new BeanA();
> beanA.setId(2);
> beanA.setParent((BeanB) session.load(BeanB.class, 1));
> session.save(beanA);
> transaction.commit();
> session.close();
> org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: ru.arptek.arpsite.data.manytoonelazy.BeanA.parent -> ru.arptek.arpsite.data.manytoonelazy.BeanB
> at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:273)
> at org.hibernate.engine.Cascade.cascade(Cascade.java:257)
> at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
> at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
> at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
> at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
> at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
> at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
> at org.hibernate.transaction.JTATransaction.commit(JTATransaction.java:135)
> at ru.arptek.arpsite.data.manytoonelazy.TestWithoutCache.testFind(TestWithoutCache.java:57)
> 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:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> 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)
> Temporary patch included. May be it is brokes other issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-2511) generated="insert/always" ignored for property in composite-element?
by James Garrison (JIRA)
generated="insert/always" ignored for property in composite-element?
--------------------------------------------------------------------
Key: HHH-2511
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2511
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Hibernate 3.2.2, Windows XP SP2, Oracle 9i
Reporter: James Garrison
Priority: Minor
I have a composite-element (in an idbag) that has a db-generated timestamp
property. I have defined the property with update="false" insert="false" generated="insert",
but Hibernate is trying to insert a null value when saving a transient object.
See below, the "createTs" property (column=CREATE_TS) in the "comments"
composite-element.
DDL:
create table CR_COMMENT
(
COMMENT_ID integer not null,
REQ_ID integer not null,
CREATE_TS timestamp default sysdate not null,
SECTION_ID char(1) not null,
USER_ID varchar2(20) not null,
TEXT varchar2(4000) not null,
primary key(COMMENT_ID),
foreign key(REQ_ID) references CR_REQUEST (REQ_ID) on delete cascade
);
Mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.wholefoods.ittoolkit.ws.ccf">
<class name="Request" table="CR_REQUEST">
<id name="reqId" column="REQ_ID" type="long">
<generator class="sequence">
<param name="sequence">CR_REQUEST_ID</param>
</generator>
</id>
[snip]
<idbag name="comments" table="CR_COMMENT">
<collection-id type="long" column="COMMENT_ID">
<generator class="sequence">
<param name="sequence">CR_COMMENT_ID</param>
</generator>
</collection-id>
<key column="REQ_ID" />
<composite-element class="Comment">
<property name="createTs" column="CREATE_TS"
type="calendar"
access="field"
update="false"
insert="false"
generated="insert" />
<property name="sectionId" column="SECTION_ID" />
<property name="userId" column="USER_ID" />
<property name="text" column="TEXT"/>
</composite-element>
</idbag>
</class>
</hibernate-mapping>
Log Output:
Hibernate:
/* insert collection
row com.wholefoods.ittoolkit.ws.ccf.Request.comments */ insert
into
ITTOOLKIT.CR_COMMENT
(REQ_ID, COMMENT_ID, CREATE_TS, SECTION_ID, USER_ID, TEXT)
values
(?, ?, ?, ?, ?, ?)
10:15:01,659 DEBUG org.hibernate.jdbc.AbstractBatcher:476 - preparing statement
10:15:01,675 DEBUG org.hibernate.type.LongType:133 - binding '47' to parameter: 1
10:15:01,675 DEBUG org.hibernate.type.LongType:133 - binding '7' to parameter: 2
10:15:01,675 DEBUG org.hibernate.type.CalendarType:126 - binding null to parameter: 3
10:15:01,675 DEBUG org.hibernate.type.StringType:133 - binding 'A' to parameter: 4
10:15:01,690 DEBUG org.hibernate.type.StringType:133 - binding 'garrisoj' to parameter: 5
10:15:01,690 DEBUG org.hibernate.type.StringType:133 - binding 'This is a test comment' to parameter: 6
10:15:01,690 DEBUG org.hibernate.persister.collection.AbstractCollectionPersister:1172 - done inserting collection: 1 rows inserted
10:15:01,690 DEBUG org.hibernate.jdbc.AbstractBatcher:44 - Executing batch size: 1
10:15:01,737 DEBUG org.hibernate.jdbc.AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
10:15:01,737 DEBUG org.hibernate.jdbc.AbstractBatcher:525 - closing statement
10:15:01,768 DEBUG org.hibernate.util.JDBCExceptionReporter:69 - Could not execute JDBC batch update
[/* insert collection row com.wholefoods.ittoolkit.ws.ccf.Request.comments */
insert into ITTOOLKIT.CR_COMMENT (REQ_ID, COMMENT_ID, CREATE_TS, SECTION_ID, USER_ID, TEXT)
values (?, ?, ?, ?, ?, ?)]
java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("ITTOOLKIT"."CR_COMMENT"."CREATE_TS")
--
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
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-6945) EventListeners not called with Hibernate 4.0
by Jakob Braeuchi (JIRA)
EventListeners not called with Hibernate 4.0
--------------------------------------------
Key: HHH-6945
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6945
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Final
Environment: windows 7
Reporter: Jakob Braeuchi
Priority: Critical
Attachments: test.events.zip
i tried to upgrade hibernate from version 3.6.9 to 4.0.0 .
in my config i have some EventListeners used for auditing. after adapting my Listeners to the new api (event.FlushEventListener -> event.spi.FlushEventListener) i found that none of my listeners is called.
the attached zip contains a small testcase with Flush-, PreInsert- and PostInsertEventListeners.
this testcase works with hibernate 3.6 and i can see the output of the listeners in the console.
hibernate 3.6 logs the EventListeners to the console:
23:08:07,827 DEBUG Configuration:2406 - Event listeners: flush=test.events.MyFlushEventListener, org.hibernate.event.def.DefaultFlushEventListener
23:08:07,837 DEBUG Configuration:2406 - Event listeners: pre-insert=test.events.MyPreInsertEventListener
23:08:07,840 DEBUG Configuration:2406 - Event listeners: post-insert=test.events.MyPostInsertEventListener
there's no such output from hibernate 4.0
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-6063) The fix for HHH-5126 breaks array constructor in PostgreSQL
by Jon Vincent (JIRA)
The fix for HHH-5126 breaks array constructor in PostgreSQL
-----------------------------------------------------------
Key: HHH-6063
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6063
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.Alpha1, 3.6.2, 3.6.1
Environment: PostgreSQL, any version
Reporter: Jon Vincent
The fix for HHH-5126 supports this JPA2-compliant IN query:
{{{
SELECT * FROM my_table WHERE id IN :collection
}}}
Before HHH-5126 was fixed, Hibernate required the developer to surround collection-valued parameters with parentheses:
{{{
SELECT * FROM my_table WHERE id IN (:collection)
}}}
The implemented fix was simply to output parentheses in the generated SQL. Unfortunately, this breaks _other_ uses of collection-values parameters, such as for arrays in PostgreSQL:
{{{
CREATE TABLE my_table (some_array INTEGER[]);
INSERT INTO my_table (some_array) VALUES (ARRAY[:collection]);
}}}
Is there a way to turn off the fix for HHH-5126? For us, at least, the old code was more flexible and allowed access to important database features.
--
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
12 years, 12 months
[Hibernate-JIRA] Created: (HHH-2455) "Could not close a JDBC result set" output very often
by Dirk Feufel (JIRA)
"Could not close a JDBC result set" output very often
-----------------------------------------------------
Key: HHH-2455
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2455
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Reporter: Dirk Feufel
Priority: Minor
If you call this type of code (like the DbTimestampType class does), the AbstractBatcher outputs a warning "Could not close a JDBC result set".
The problem should be that closing the prepared statement internally also closes the associated result sets and the AbstractBatcher still has a reference to this result set.
One possible solution might be to provide an additional method
public void closeStatement(PreparedStatement ps, ResultSet rs);
(as already present for closeQueryStatement) in the AbstractBatcher allowing to close both in the right order.
PreparedStatement ps = null;
try {
ps = session.getBatcher().prepareStatement( timestampSelectString );
ResultSet rs = session.getBatcher().getResultSet( ps );
....
} finally {
if ( ps != null ) {
session.getBatcher().closeStatement( ps );
}
}
--
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
12 years, 12 months