[Hibernate-JIRA] Created: (EJB-320) Wrong column type: areccod, expected: varchar(2)
by Luis Medalhas (JIRA)
Wrong column type: areccod, expected: varchar(2)
------------------------------------------------
Key: EJB-320
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-320
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.2.1
Environment: Informix IDS 10 on Linux, JBoss 4.2GA, JBoss Seam 2.0 CR2
Reporter: Luis Medalhas
Priority: Critical
I'm using an Entity bean that look something like this
@Entity
@Table(name="ep3prj_t")
public class Project {
@Id
private int aprjkey;
@Length(max=2)
private String areccod;
...
In the database the column "areccod" of the table "ep3prj_t" is defined as char(2).
When i deploy the application the deployement fails because of this error:
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: areccod, expected: varchar(2)
I think using a String should be valid for the types CHAR and VARCHAR , i cannot change the data type because this database is mantained by the customer.
Regards.
--
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
[Hibernate-JIRA] Created: (HHH-2916) Native Sequence Usage
by Jigar Sutaria (JIRA)
Native Sequence Usage
---------------------
Key: HHH-2916
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2916
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Environment: Oracle
Reporter: Jigar Sutaria
Priority: Trivial
I tried this but I really couldnt figure out if this can be done or not. Consider the following case
1. There is a Master detail Relation
2. Primary key in master table is generated using sequence
3. This generated id will also be used in detail table
In order to do above scenario, I have to take following steps (Correct me id I am wrong)
1. Bean Mapped to Master table needs to be saved first
2. Put any query to get primary key generated while above save operation using other data field of the table
3. Populate your Master bean with primary key
4. Set the primary key in all the details that needs to be saved
Now, here I can see over head of one query (Step 2) just because we are not populating our bean with primary key while persisting it.
By any mechanism if hibernate saves the primary key value in the associated bean after querying (SELECT seq.nextval from dual) then
Step 2 can be avoided.
--
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
[Hibernate-JIRA] Updated: (HHH-1400) Using formula-based property causes invalid SQL code for children "subselect" query
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400?page=c... ]
Diego Pires Plentz updated HHH-1400:
------------------------------------
Summary: Using formula-based property causes invalid SQL code for children "subselect" query (was: CLONE -Using formula-based property causes invalid SQL code for children "subselect" query)
> Using formula-based property causes invalid SQL code for children "subselect" query
> -----------------------------------------------------------------------------------
>
> Key: HHH-1400
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1400
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 rc3
> Environment: Hibernate 3.0.5, Hibernate 3.1rc3
> Oracle 8i
> Reporter: Chris Rogers
> Attachments: SubselectFetch.java, subselectformula.zip, SubselectFormulaBug.zip
>
>
> I have simple one-to-many relationship, mapped as set:
> <class name="Parent">
> <set name="children" lazy="false" fetch="subselect">
> <key column="PARENT_OID"/>
> <one-to-many class="Child"/>
> </set>
> </class>
> this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
> select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
> (simplified)
> However, when adding a formula-based property into Parent:
> <property name="myFormulaField" formula="(complex_select )"/>
> Now SQL becomes:
> select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)
> This SQL fails because of incorrect grammar (it also seems that backet is missing).
> This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.
> I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.
> This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.
--
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
[Hibernate-JIRA] Created: (HHH-2000) CLONE -merge() with one-to-one throws ClassCastException
by Marco Rothe (JIRA)
CLONE -merge() with one-to-one throws ClassCastException
--------------------------------------------------------
Key: HHH-2000
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2000
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1 beta 2
Reporter: Marco Rothe
Hibernate tries to bind a persistent object to a long variable in a SQL statement during a call to merge() on an object with a one-to-one relation.
I originally posted about this problem here: http://forum.hibernate.org/viewtopic.php?t=948272&highlight=
I have created and attached a junit test to reproduce the problem. When running against 3.0 or 3.1beta2 the ClassCastException is thrown all the way out, as shown in the forum post. The latest code from cvs catches the exception and logs it. org.hibernate.type.NullableType.java rev 1.10 is where the exception is caught. It seems like it should be logged and then re-thrown, but it's not. The debug log from the start of the merge() call to where it logs that it failed to bind the value is:
[junit] 11:12:32,461 DEBUG SessionImpl:271 - opened session at timestamp: 11283595524
[junit] 11:12:32,461 DEBUG JDBCTransaction:54 - begin
[junit] 11:12:32,461 DEBUG ConnectionManager:309 - opening JDBC connection
[junit] 11:12:32,461 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
[junit] 11:12:32,461 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0
[junit] 11:12:32,461 DEBUG JDBCTransaction:59 - current autocommit status: false
[junit] 11:12:32,461 DEBUG JDBCContext:207 - before transaction completion
[junit] 11:12:32,477 DEBUG IdentifierValue:207 - id unsaved-value: null
[junit] 11:12:32,477 DEBUG AbstractSaveEventListener:470 - detached instance of: org.hibernate.test.onetoone.merge.Person
[junit] 11:12:32,477 DEBUG DefaultMergeEventListener:185 - merging detached instance
[junit] 11:12:32,477 DEBUG DefaultLoadEventListener:153 - loading entity: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,477 DEBUG DefaultLoadEventListener:304 - attempting to resolve: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,477 DEBUG DefaultLoadEventListener:340 - object not resolved in any cache: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,477 DEBUG ConnectionManager:389 - running Session.finalize()
[junit] 11:12:32,477 DEBUG AbstractEntityPersister:2722 - Fetching entity: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,493 DEBUG Loader:1774 - loading entity: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,493 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[junit] 11:12:32,493 DEBUG SQL:344 -
[junit] select
[junit] person0_.person_id as person1_0_0_
[junit] from
[junit] person person0_
[junit] where
[junit] person0_.person_id=?
[junit] 11:12:32,493 DEBUG AbstractBatcher:413 - preparing statement
[junit] 11:12:32,493 DEBUG AbstractBatcher:325 - about to open ResultSet (open ResultSets: 0, globally: 0)
[junit] 11:12:32,508 DEBUG Loader:682 - processing result set
[junit] 11:12:32,508 DEBUG Loader:687 - result set row: 0
[junit] 11:12:32,508 DEBUG Loader:1164 - result row: EntityKey[org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,508 DEBUG Loader:1347 - Initializing object from ResultSet: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,508 DEBUG AbstractEntityPersister:1859 - Hydrating entity: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,508 DEBUG Loader:709 - done processing result set (1 rows)
[junit] 11:12:32,524 DEBUG AbstractBatcher:332 - about to close ResultSet (open ResultSets: 1, globally: 1)
[junit] 11:12:32,524 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[junit] 11:12:32,524 DEBUG AbstractBatcher:459 - closing statement
[junit] 11:12:32,524 DEBUG Loader:839 - total objects hydrated: 1
[junit] 11:12:32,524 DEBUG TwoPhaseLoad:104 - resolving associations for [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,524 DEBUG Loader:1774 - loading entity: [org.hibernate.test.onetoone.merge.Address#1]
[junit] 11:12:32,539 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[junit] 11:12:32,539 DEBUG SQL:344 -
[junit] select
[junit] address0_.address_id as address1_1_0_,
[junit] address0_.person_id as person2_1_0_
[junit] from
[junit] address address0_
[junit] where
[junit] address0_.person_id=?
[junit] 11:12:32,555 DEBUG AbstractBatcher:413 - preparing statement
[junit] 11:12:32,555 DEBUG AbstractBatcher:325 - about to open ResultSet (open ResultSets: 0, globally: 0)
[junit] 11:12:32,555 DEBUG Loader:682 - processing result set
[junit] 11:12:32,571 DEBUG Loader:687 - result set row: 0
[junit] 11:12:32,571 DEBUG Loader:1164 - result row: EntityKey[org.hibernate.test.onetoone.merge.Address#2]
[junit] 11:12:32,571 DEBUG Loader:1347 - Initializing object from ResultSet: [org.hibernate.test.onetoone.merge.Address#2]
[junit] 11:12:32,571 DEBUG AbstractEntityPersister:1859 - Hydrating entity: [org.hibernate.test.onetoone.merge.Address#2]
[junit] 11:12:32,571 DEBUG Loader:709 - done processing result set (1 rows)
[junit] 11:12:32,571 DEBUG AbstractBatcher:332 - about to close ResultSet (open ResultSets: 1, globally: 1)
[junit] 11:12:32,571 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[junit] 11:12:32,571 DEBUG AbstractBatcher:459 - closing statement
[junit] 11:12:32,586 DEBUG Loader:839 - total objects hydrated: 1
[junit] 11:12:32,586 DEBUG TwoPhaseLoad:104 - resolving associations for [org.hibernate.test.onetoone.merge.Address#2]
[junit] 11:12:32,586 DEBUG DefaultLoadEventListener:153 - loading entity: [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,586 DEBUG DefaultLoadEventListener:222 - entity found in session cache
[junit] 11:12:32,602 DEBUG TwoPhaseLoad:203 - done materializing entity [org.hibernate.test.onetoone.merge.Address#2]
[junit] 11:12:32,602 DEBUG Loader:1805 - done entity load
[junit] 11:12:32,602 DEBUG TwoPhaseLoad:203 - done materializing entity [org.hibernate.test.onetoone.merge.Person#1]
[junit] 11:12:32,602 DEBUG StatefulPersistenceContext:784 - initializing non-lazy collections
[junit] 11:12:32,602 DEBUG Loader:1805 - done entity load
[junit] 11:12:32,602 DEBUG Loader:1774 - loading entity: [org.hibernate.test.onetoone.merge.Address#org.hibernate.test.onetoone.merge.Person@153f67e]
[junit] 11:12:32,602 DEBUG AbstractBatcher:309 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
[junit] 11:12:32,602 DEBUG SQL:344 -
[junit] select
[junit] address0_.address_id as address1_1_0_,
[junit] address0_.person_id as person2_1_0_
[junit] from
[junit] address address0_
[junit] where
[junit] address0_.person_id=?
[junit] 11:12:32,618 DEBUG AbstractBatcher:413 - preparing statement
[junit] 11:12:32,618 INFO LongType:89 - could not bind value 'org.hibernate.test.onetoone.merge.Person@153f67e' to parameter: 1
Running the test on HSQLDB with the latest from cvs hides the problem (logs it as INFO, but doesn't complain that nothing is bound to the variable), but if you run on PostgreSQL, for example, it complains (SQLException) that nothing is bound to the variable when the statement is executed ( org.postgresql.util.PSQLException: No value specified for parameter 1.):
[junit] 11:12:32,633 DEBUG AbstractBatcher:317 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
[junit] 11:12:32,633 DEBUG AbstractBatcher:459 - closing statement
[junit] 11:12:32,649 DEBUG JDBCExceptionReporter:63 - could not load an entity: [org.hibernate.test.onetoone.merge.Address#org.hibernate.test.onetoone.merge.Person@153f67e] [select address0_.address_id as address1_1_0_, address0_.person_id as person2_1_0_ from address address0_ where address0_.person_id=?]
[junit] org.postgresql.util.PSQLException: No value specified for parameter 1.
[junit] at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:102)
[junit] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:166)
[junit] at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:389)
[junit] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:330)
[junit] at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:240)
[junit] at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:137)
[junit] at org.hibernate.loader.Loader.getResultSet(Loader.java:1676)
[junit] at org.hibernate.loader.Loader.doQuery(Loader.java:662)
[junit] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
[junit] at org.hibernate.loader.Loader.loadEntity(Loader.java:1782)
[junit] at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:93)
[junit] at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85)
[junit] at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1522)
[junit] at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365)
[junit] at org.hibernate.type.EntityType.resolve(EntityType.java:306)
[junit] at org.hibernate.type.EntityType.replace(EntityType.java:207)
[junit] at org.hibernate.type.TypeFactory.replace(TypeFactory.java:431)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:279)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:245)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:102)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
[junit] at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:609)
[junit] at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:595)
[junit] at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:599)
[junit] at org.hibernate.test.onetoone.merge.OneToOneTest.testOne(OneToOneTest.java:52)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:585)
[junit] at junit.framework.TestCase.runTest(TestCase.java:154)
[junit] at org.hibernate.test.TestCase.runTest(TestCase.java:140)
[junit] at junit.framework.TestCase.runBare(TestCase.java:127)
[junit] at junit.framework.TestResult$1.protect(TestResult.java:106)
[junit] at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit] at junit.framework.TestResult.run(TestResult.java:109)
[junit] at junit.framework.TestCase.run(TestCase.java:118)
[junit] at junit.framework.TestSuite.runTest(TestSuite.java:208)
[junit] at junit.framework.TestSuite.run(TestSuite.java:203)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:672)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:567)
[junit] 11:12:32,664 WARN JDBCExceptionReporter:71 - SQL Error: 0, SQLState: 22023
[junit] 11:12:32,664 ERROR JDBCExceptionReporter:72 - No value specified for parameter 1.
[junit] 11:12:32,680 DEBUG SessionImpl:290 - closing session
[junit] 11:12:32,680 DEBUG ConnectionManager:330 - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
[junit] 11:12:32,680 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
[junit] 11:12:32,680 INFO SessionFactoryImpl:865 - closing
[junit] 11:12:32,680 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:postgresql://localhost:5432/hibtest
[junit] 11:12:32,680 INFO SchemaExport:153 - Running hbm2ddl schema export
[junit] 11:12:32,696 DEBUG SchemaExport:171 - import file not found: /import.sql
[junit] 11:12:32,696 INFO SchemaExport:180 - exporting generated schema to database
[junit] 11:12:32,696 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
[junit] 11:12:32,696 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
[junit] 11:12:32,774 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:postgresql://localhost:5432/hibtest, Isolation Level: 2
[junit] 11:12:32,789 DEBUG SchemaExport:283 -
[junit] alter table address
[junit] drop constraint FKBB979BF4986F6BA3
[junit] 11:12:32,805 DEBUG SchemaExport:283 -
[junit] drop table address
[junit] 11:12:32,836 DEBUG SchemaExport:283 -
[junit] drop table person
[junit] 11:12:32,867 DEBUG SchemaExport:283 -
[junit] drop sequence hibernate_sequence
[junit] 11:12:32,883 INFO SchemaExport:200 - schema export complete
[junit] 11:12:32,883 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 5.233 sec
[junit] Test org.hibernate.test.onetoone.merge.OneToOneTest FAILED
--
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
[Hibernate-JIRA] Resolved: (HHH-1916) param values in generator element should be trimmed during HbmBinding
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1916?page=c... ]
Diego Pires Plentz resolved HHH-1916.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Fixed
Fix Version/s: 3.2.6
Fixed in 3.2 branch / trunk.
> param values in generator element should be trimmed during HbmBinding
> ---------------------------------------------------------------------
>
> Key: HHH-1916
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1916
> Project: Hibernate3
> Issue Type: Bug
> Components: metamodel
> Affects Versions: 3.1.3, 3.2.0.cr3
> Environment: Oracle 10g, JDK 1.5.0_06, linux, hibernate 3.1.3
> Reporter: Renaud Bruyeron
> Assignee: Diego Pires Plentz
> Fix For: 3.2.6
>
> Attachments: patch-Branch_3_1.txt, patch-Branch_3_2.txt
>
>
> When using IDEs or tools like xdoclet to generate HBM files, it is easy to get XML like this:
> <generator class="sequence">
> <param
> name="sequence"
> >
> SEQ_SOME_SEQUENCE
> </param>
> </generator>
> However the SchemaValidator barfs on this because the HbmBinder does not trim the sequence name.
> The fix is similar to the fix for HBX-423 I believe, i.e. in HbmBinder.java in method makeIdentifier(...), use getTextTrim() instead of getText().
> In 3.1 branch, this is at line 1902. On trunk this is line 1990.
--
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