[Hibernate-JIRA] Created: (HHH-5112) Accessing an object containing a *ToOne-Association using NO_PROXY option for lazy fetching
by Saša Obradović (JIRA)
Accessing an object containing a *ToOne-Association using NO_PROXY option for lazy fetching
-------------------------------------------------------------------------------------------
Key: HHH-5112
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5112
Project: Hibernate Core
Issue Type: Bug
Components: core, envers
Affects Versions: 3.5.0-Final, 3.3.2
Environment: Oracle, instrumentation using Javassist
Reporter: Saša Obradović
Attachments: enversbug.jpg, field [id] not found.zip, oracle-ddl.sql
Adding an element to a collection:
{{A a = entityManager.find(A.class, 505L);}}
{{B b = new B();}}
{{a.addToB(b);}}
results in following exception:
{quote}
javax.persistence.PersistenceException: org.hibernate.PropertyNotFoundException: field [id] not found on org.hibernate.intercept.LazyPropertyInitializer$1
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1179)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1112)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1118)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:738)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
at $Proxy90.flush(Unknown Source)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
at $Proxy90.flush(Unknown Source)
at at.ing.diba.helper.TestMethodFlusherBeanAspect.executeFlush(TestMethodFlusherBeanAspect.java:27)
at at.ing.diba.service.architektur.BugTest.testEnvers_aroundBody6(BugTest.java:69)
at at.ing.diba.service.architektur.BugTest$AjcClosure7.run(BugTest.java:1)
at at.ing.diba.manager.ServiceMethodTracingAspect.traceServiceMethod(ServiceMethodTracingAspect.java:40)
at at.ing.diba.service.architektur.BugTest.testEnvers(BugTest.java:65)
at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:158)
Caused by: org.hibernate.PropertyNotFoundException: field [id] not found on org.hibernate.intercept.LazyPropertyInitializer$1
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:182)
at org.hibernate.property.DirectPropertyAccessor.getField(DirectPropertyAccessor.java:174)
at org.hibernate.property.DirectPropertyAccessor.getGetter(DirectPropertyAccessor.java:197)
at org.hibernate.envers.entities.mapper.id.SingleIdMapper.mapToMapFromEntity(SingleIdMapper.java:104)
at org.hibernate.envers.entities.mapper.relation.ToOneIdMapper.mapToMapFromEntity(ToOneIdMapper.java:68)
at org.hibernate.envers.entities.mapper.MultiPropertyMapper.map(MultiPropertyMapper.java:86)
at org.hibernate.envers.synchronization.work.ModWorkUnit.<init>(ModWorkUnit.java:48)
at org.hibernate.envers.event.AuditEventListener.onPostUpdate(AuditEventListener.java:165)
at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:199)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:178)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:180)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:735)
... 47 more
{quote}
The exception is related to the association between A and C, although it hasn't changed in the transaction. No exception is thrown if the lazy fetching of C (in class A) is declared "proxy".
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5143) Lazy Loading Not Working for @OneToOne Associations With LazyToOneOption.PROXY
by j nadler (JIRA)
Lazy Loading Not Working for @OneToOne Associations With LazyToOneOption.PROXY
------------------------------------------------------------------------------
Key: HHH-5143
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5143
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1
Environment: Hibernate Core 3.5.1-Final, MySQL 5.1
Reporter: j nadler
I'm using 3.5.1. Two persistent entities, parent and child, are in a one to one relationship:
In Parent, the reference to Child:
@OneToOne(optional=false, fetch=FetchType.LAZY, cascade={ CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.PERSIST })
@LazyToOne(LazyToOneOption.PROXY)
@JoinColumn(name = "childId")
@ForeignKey(name="FK_Parent_Child")
@IndexedEmbedded()
public Child getChild() {
return child;
}
public void setChild(Child child) {
this.child = child;
}
And in Child, the reference to Parent:
@OneToOne(mappedBy="child", fetch=FetchType.LAZY)
@LazyToOne(LazyToOneOption.PROXY)
@ContainedIn
public Parent getParent() {
return parent;
}
public void setParent(Parent parent) {
this.parent = parent;
}
When I load a Parent entity via HQL, I see three SQL queries:
-one that corresponds to my HQL query
-one that loads Child
-one that loads Parent from the Child's perspective
I'm watching it in JProfiler and it's hurting our app performance significantly because Child contains LOBs that are rarely needed.
I tried making it a unidirectional association (no reference from Child back to Parent) but the expensive SQL call (loading Child) still happens. That gets it down to two SQL queries:
-one that corresponds to my HQL query
-one that loads Child (the expensive one)
We are using the stock javassist proxies and no bytecode enhancement.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-4773) unit tests fail cos db2 doesn't allow primary key column nullable
by Strong Liu (JIRA)
unit tests fail cos db2 doesn't allow primary key column nullable
-----------------------------------------------------------------
Key: HHH-4773
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4773
Project: Hibernate Core
Issue Type: Bug
Components: testsuite
Affects Versions: 3.5.0-Beta-2, 3.5.0.Beta-1, 3.3.2
Environment: db2
Reporter: Strong Liu
org.hibernate.search.test.embedded.EmbeddedTest.testIndexedEmbeddedAndCollections
Column 'CUST_NAME' is part of a primary key constraint and cannot be null.
org.hibernate.test.annotations.target.TargetTest.testTargetOnMapKey
19:47:29,104 DEBUG SchemaExport:377 -
create table Brand_LuggageImpl (
Brand_id bigint not null,
luggagesBySize_id bigint not null,
name varchar(255),
primary key (Brand_id, name)
)
19:47:29,129 ERROR SchemaExport:348 - Unsuccessful: create table Brand_LuggageImpl (Brand_id bigint not null, luggagesBySize_id bigint not null, name varchar(255), primary key (Brand_id, name))
org.hibernate.test.annotations.collectionelement.indexedCollection.IndexedCollectionOfElementsTest.testIndexedCollectionOfElements
create table contact (
n_key_person integer not null,
name varchar(255),
n_key_contact bigint,
primary key (n_key_contact)
)
19:45:24,074 ERROR SchemaExport:348 - Unsuccessful: create table contact (n_key_person integer not null, name varchar(255), n_key_contact bigint, primary key (n_key_contact))
19:45:24,073 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: N_KEY_CONTACT
org.hibernate.test.annotations.any.AnyTest.testManyToAnyWithMap
19:43:44,418 DEBUG SchemaExport:377 -
alter table map_properties
add constraint FKF2788BF69AF4A643
foreign key (map_id)
references property_map
19:43:44,420 ERROR SchemaExport:348 - Unsuccessful: alter table map_properties add constraint FKF2788BF69AF4A643 foreign key (map_id) references property_map
19:43:44,420 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: HIBBR330.MAP_PROPERTIES
org.hibernate.test.annotations.identifiercollection.IdentifierCollectionTest.testIdBag
19:44:05,449 DEBUG SchemaExport:377 -
create table PASSPORT_STAMP (
Passport_passport_id bigint not null,
stamps_id bigint not null,
COLLECTION_ID bigint,
primary key (COLLECTION_ID)
)
19:44:05,494 ERROR SchemaExport:348 - Unsuccessful: create table PASSPORT_STAMP (Passport_passport_id bigint not null, stamps_id bigint not null, COLLECTION_ID bigint, primary key (COLLECTION_ID))
19:44:05,493 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: COLLECTION_ID
19:44:05,494 DEBUG SchemaExport:377 -
create table PASSPORT_VISASTAMP (
Passport_passport_id bigint not null,
visaStamp_id bigint not null,
COLLECTION_ID bigint,
primary key (COLLECTION_ID)
)
19:44:05,526 ERROR SchemaExport:348 - Unsuccessful: create table PASSPORT_VISASTAMP (Passport_passport_id bigint not null, visaStamp_id bigint not null, COLLECTION_ID bigint, primary key (COLLECTION_ID))
19:44:05,525 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: COLLECTION_ID
org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.testRealMap
19:46:31,064 DEBUG SchemaExport:377 -
create table Atmosphere_Gas (
Atmosphere_id integer not null,
gases_id integer not null,
gas_name varchar(255),
primary key (Atmosphere_id, gas_name)
)
19:46:31,093 ERROR SchemaExport:348 - Unsuccessful: create table Atmosphere_Gas (Atmosphere_id integer not null, gases_id integer not null, gas_name varchar(255), primary key (Atmosphere_id, gas_name))
19:46:31,094 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: GAS_NAME
org.hibernate.test.annotations.collectionelement.CollectionElementTest
19:45:09,816 DEBUG SchemaExport:377 -
create table Matrix_values (
Matrix_id integer not null,
element float,
mapkey integer,
primary key (Matrix_id, mapkey)
)
19:45:09,844 ERROR SchemaExport:348 - Unsuccessful: create table Matrix_values (Matrix_id integer not null, element float, mapkey integer, primary key (Matrix_id, mapkey))
19:45:09,845 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: MAPKEY
19:45:09,844 DEBUG SchemaExport:377 -
create table ScorePerNickName (
BoyId integer not null,
fld_score integer,
mapkey varchar(255),
primary key (BoyId, mapkey)
)
19:45:09,872 ERROR SchemaExport:348 - Unsuccessful: create table ScorePerNickName (BoyId integer not null, fld_score integer, mapkey varchar(255), primary key (BoyId, mapkey))
19:45:09,871 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: MAPKEY
19:45:09,871 DEBUG SchemaExport:377 -
create table TestCourse (
testCourseId bigint generated by default as identity,
primary key (testCourseId)
)
19:45:09,920 DEBUG SchemaExport:377 -
create table TestCourse_variations (
TestCourse_testCourseId bigint not null,
element varchar(255),
language_code varchar(255),
primary key (TestCourse_testCourseId, language_code)
)
19:45:09,944 ERROR SchemaExport:348 - Unsuccessful: create table TestCourse_variations (TestCourse_testCourseId bigint not null, element varchar(255), language_code varchar(255), primary key (TestCourse_testCourseId, language_code))
19:45:09,946 ERROR SchemaExport:349 - DB2 SQL error: SQLCODE: -542, SQLSTATE: 42831, SQLERRMC: LANGUAGE_CODE
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-3349) SequenceStyleGenerator generates strange IDs for PostgreSQL database
by Adam Wozniak (JIRA)
SequenceStyleGenerator generates strange IDs for PostgreSQL database
--------------------------------------------------------------------
Key: HHH-3349
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3349
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: hibernate-3.2.6.ga, hibernate-annotations-3.3.1.GA, hibernate-entitymanager-3.3.2.GA, hibernate-validator-3.0.0.GA, PostgreSQL 8.3.1 on Windows box. Sun Java 6 (Win32 on Vista 32 bits).
Reporter: Adam Wozniak
Hello
I've got a standalone application using environment:
* PostgreSQL 8.3.1 (Win 32)
* hibernate-3.2.6.ga
* hibernate-annotations-3.3.1.GA
* hibernate-entitymanager-3.3.2.GA
* hibernate-validator-3.0.0.GA
I've got a PostgreSQL database sequence:
CREATE SEQUENCE t_seq
INCREMENT 10
MINVALUE 1
MAXVALUE 999999999999999999
START 11;
My entity:
@Entity
@Table(name = "T")
@org.hibernate.annotations.Entity(dynamicUpdate=true, dynamicInsert=true)
public class T
{
private long id;
@Id
@Column(unique = true, nullable = false, precision = 18, scale = 0)
@GeneratedValue(generator = "t_generator")
@GenericGenerator( name = "t_generator",
strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
parameters = {
@Parameter(name = "sequence_name", value = "T_SEQ")
, @Parameter(name = "increment_size", value = "10")
, @Parameter(name = "optimizer", value = "pooled")
}
)
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
}
And my test application to recreate this issue:
for(int i = 0; i < 11; i++)
{
if(i == 0 || i == 10)
System.out.println("Database hit to sequence will be performed.");
T t = new T();
em.persist(t);
}
Reading this Steve Ebersole description ( http://blog.hibernate.org/2082.lace#comments ) I would expect, that I will get the following IDs:
11
12
13
14
15
16
17
18
19
20
21
But Hibernate generates:
101
102
103
104
105
106
107
108
109
110
111
Is it something wrong with my code? Or this is a issue in Hibernate?
Note please, that on the same page ( http://blog.hibernate.org/2082.lace#comments ) other person claims that it doesn't work for his configuration based on PostgreSQL.
You will find my log4j output for my test application on the end of my email.
Regards,
Adam Wozniak
Piece of my log4j output:
2008-06-17 20:20:38,198 [main] DEBUG () SessionImpl: opened session at timestamp: 12137268381
2008-06-17 20:20:38,200 [main] DEBUG () JDBCTransaction: begin
2008-06-17 20:20:38,200 [main] DEBUG () ConnectionManager: opening JDBC connection
2008-06-17 20:20:38,200 [main] DEBUG () BasicResourcePool: trace com.mchange.v2.resourcepool.BasicResourcePool@104a4b6 [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@b206e9)
2008-06-17 20:20:38,202 [main] DEBUG () JDBCTransaction: current autocommit status: true
2008-06-17 20:20:38,202 [main] DEBUG () JDBCTransaction: disabling autocommit
2008-06-17 20:20:38,202 [main] DEBUG () JDBCContext: after transaction begin
Database hit to sequence will be performed.
2008-06-17 20:20:39,467 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,469 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,469 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,472 [main] DEBUG () AbstractBatcher: about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2008-06-17 20:20:39,479 [main] DEBUG () AbstractBatcher:
select
nextval ('T_SEQ')
Hibernate:
select
nextval ('T_SEQ')
2008-06-17 20:20:39,480 [main] DEBUG () AbstractBatcher: preparing statement
2008-06-17 20:20:39,489 [main] DEBUG () GooGooStatementCache: cxnStmtMgr.statementSet( org.postgresql.jdbc4.Jdbc4Connection@1df3082 ).size(): 1
2008-06-17 20:20:39,489 [main] DEBUG () GooGooStatementCache: checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 1; num connections: 1; num keys: 1
2008-06-17 20:20:39,506 [main] DEBUG () SequenceStructure$1: Sequence identifier generated: 11
2008-06-17 20:20:39,506 [main] DEBUG () AbstractBatcher: about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-06-17 20:20:39,507 [main] DEBUG () AbstractBatcher: closing statement
2008-06-17 20:20:39,507 [main] DEBUG () GooGooStatementCache: checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
2008-06-17 20:20:39,508 [main] DEBUG () AbstractSaveEventListener: generated identifier: 101, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,513 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#101]
2008-06-17 20:20:39,530 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,530 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,530 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,530 [main] DEBUG () AbstractSaveEventListener: generated identifier: 102, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,531 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#102]
2008-06-17 20:20:39,531 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,531 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,531 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,532 [main] DEBUG () AbstractSaveEventListener: generated identifier: 103, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,532 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#103]
2008-06-17 20:20:39,533 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,533 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,533 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,533 [main] DEBUG () AbstractSaveEventListener: generated identifier: 104, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,534 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#104]
2008-06-17 20:20:39,534 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,534 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,534 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,534 [main] DEBUG () AbstractSaveEventListener: generated identifier: 105, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,535 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#105]
2008-06-17 20:20:39,535 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,535 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,535 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,536 [main] DEBUG () AbstractSaveEventListener: generated identifier: 106, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,536 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#106]
2008-06-17 20:20:39,537 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,537 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,537 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,537 [main] DEBUG () AbstractSaveEventListener: generated identifier: 107, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,537 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#107]
2008-06-17 20:20:39,538 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,538 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,538 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,538 [main] DEBUG () AbstractSaveEventListener: generated identifier: 108, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,539 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#108]
2008-06-17 20:20:39,539 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,539 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,539 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,539 [main] DEBUG () AbstractSaveEventListener: generated identifier: 109, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,540 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#109]
2008-06-17 20:20:39,541 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:39,541 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:39,541 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:39,541 [main] DEBUG () AbstractSaveEventListener: generated identifier: 110, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:39,541 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#110]
Database hit to sequence will be performed.
2008-06-17 20:20:40,912 [main] DEBUG () IdentifierValue: id unsaved-value: 0
2008-06-17 20:20:40,912 [main] DEBUG () AbstractSaveEventListener: transient instance of: net.cellbell.model.T
2008-06-17 20:20:40,913 [main] DEBUG () DefaultPersistEventListener: saving transient instance
2008-06-17 20:20:40,913 [main] DEBUG () AbstractBatcher: about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2008-06-17 20:20:40,913 [main] DEBUG () AbstractBatcher:
select
nextval ('T_SEQ')
Hibernate:
select
nextval ('T_SEQ')
2008-06-17 20:20:40,914 [main] DEBUG () AbstractBatcher: preparing statement
2008-06-17 20:20:40,914 [main] DEBUG () GooGooStatementCache: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache ----> CACHE HIT
2008-06-17 20:20:40,914 [main] DEBUG () GooGooStatementCache: checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 1; num connections: 1; num keys: 1
2008-06-17 20:20:40,917 [main] DEBUG () SequenceStructure$1: Sequence identifier generated: 21
2008-06-17 20:20:40,917 [main] DEBUG () AbstractBatcher: about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-06-17 20:20:40,917 [main] DEBUG () AbstractBatcher: closing statement
2008-06-17 20:20:40,917 [main] DEBUG () GooGooStatementCache: checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 1; checked out: 0; num connections: 1; num keys: 1
2008-06-17 20:20:40,918 [main] DEBUG () AbstractSaveEventListener: generated identifier: 111, using strategy: org.hibernate.id.enhanced.SequenceStyleGenerator
2008-06-17 20:20:40,918 [main] DEBUG () AbstractSaveEventListener: saving [net.cellbell.model.T#111]
2008-06-17 20:20:40,919 [main] DEBUG () JDBCTransaction: commit
2008-06-17 20:20:40,919 [main] DEBUG () SessionImpl: automatically flushing session
2008-06-17 20:20:40,922 [main] DEBUG () AbstractFlushingEventListener: flushing session
2008-06-17 20:20:40,923 [main] DEBUG () AbstractFlushingEventListener: processing flush-time cascades
2008-06-17 20:20:40,924 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,925 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,925 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,925 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,926 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,927 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,927 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,927 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,927 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,929 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,929 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,929 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,929 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,929 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,930 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,930 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,930 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,930 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,931 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,932 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,932 [main] DEBUG () Cascade: processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,932 [main] DEBUG () Cascade: done processing cascade ACTION_PERSIST_ON_FLUSH for: net.cellbell.model.T
2008-06-17 20:20:40,932 [main] DEBUG () AbstractFlushingEventListener: dirty checking collections
2008-06-17 20:20:40,933 [main] DEBUG () AbstractFlushingEventListener: Flushing entities and processing referenced collections
2008-06-17 20:20:40,939 [main] DEBUG () AbstractFlushingEventListener: Processing unreferenced collections
2008-06-17 20:20:40,939 [main] DEBUG () AbstractFlushingEventListener: Scheduling collection removes/(re)creates/updates
2008-06-17 20:20:40,940 [main] DEBUG () AbstractFlushingEventListener: Flushed: 11 insertions, 0 updates, 0 deletions to 11 objects
2008-06-17 20:20:40,940 [main] DEBUG () AbstractFlushingEventListener: Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2008-06-17 20:20:40,942 [main] DEBUG () Printer: listing entities:
2008-06-17 20:20:40,942 [main] DEBUG () Printer: net.cellbell.model.T{id=105}
2008-06-17 20:20:40,943 [main] DEBUG () Printer: net.cellbell.model.T{id=104}
2008-06-17 20:20:40,943 [main] DEBUG () Printer: net.cellbell.model.T{id=107}
2008-06-17 20:20:40,943 [main] DEBUG () Printer: net.cellbell.model.T{id=106}
2008-06-17 20:20:40,945 [main] DEBUG () Printer: net.cellbell.model.T{id=101}
2008-06-17 20:20:40,945 [main] DEBUG () Printer: net.cellbell.model.T{id=103}
2008-06-17 20:20:40,945 [main] DEBUG () Printer: net.cellbell.model.T{id=102}
2008-06-17 20:20:40,945 [main] DEBUG () Printer: net.cellbell.model.T{id=109}
2008-06-17 20:20:40,945 [main] DEBUG () Printer: net.cellbell.model.T{id=108}
2008-06-17 20:20:40,946 [main] DEBUG () Printer: net.cellbell.model.T{id=111}
2008-06-17 20:20:40,946 [main] DEBUG () Printer: net.cellbell.model.T{id=110}
2008-06-17 20:20:40,946 [main] DEBUG () AbstractFlushingEventListener: executing flush
2008-06-17 20:20:40,947 [main] DEBUG () ConnectionManager: registering flush begin
2008-06-17 20:20:40,951 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#101]
2008-06-17 20:20:40,956 [main] DEBUG () AbstractBatcher: about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2008-06-17 20:20:40,957 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,957 [main] DEBUG () AbstractBatcher: preparing statement
2008-06-17 20:20:40,957 [main] DEBUG () GooGooStatementCache: cxnStmtMgr.statementSet( org.postgresql.jdbc4.Jdbc4Connection@1df3082 ).size(): 2
2008-06-17 20:20:40,959 [main] DEBUG () GooGooStatementCache: checkoutStatement: com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 1; num connections: 1; num keys: 2
2008-06-17 20:20:40,959 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#101]
2008-06-17 20:20:40,960 [main] DEBUG () NullableType: binding '101' to parameter: 1
2008-06-17 20:20:40,964 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#102]
2008-06-17 20:20:40,965 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,965 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,965 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#102]
2008-06-17 20:20:40,967 [main] DEBUG () NullableType: binding '102' to parameter: 1
2008-06-17 20:20:40,967 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#103]
2008-06-17 20:20:40,967 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,968 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,968 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#103]
2008-06-17 20:20:40,970 [main] DEBUG () NullableType: binding '103' to parameter: 1
2008-06-17 20:20:40,970 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#104]
2008-06-17 20:20:40,970 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,970 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,971 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#104]
2008-06-17 20:20:40,971 [main] DEBUG () NullableType: binding '104' to parameter: 1
2008-06-17 20:20:40,971 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#105]
2008-06-17 20:20:40,972 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,972 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,972 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#105]
2008-06-17 20:20:40,973 [main] DEBUG () NullableType: binding '105' to parameter: 1
2008-06-17 20:20:40,973 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#106]
2008-06-17 20:20:40,973 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,975 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,976 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#106]
2008-06-17 20:20:40,977 [main] DEBUG () NullableType: binding '106' to parameter: 1
2008-06-17 20:20:40,977 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#107]
2008-06-17 20:20:40,977 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,978 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,979 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#107]
2008-06-17 20:20:40,979 [main] DEBUG () NullableType: binding '107' to parameter: 1
2008-06-17 20:20:40,979 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#108]
2008-06-17 20:20:40,980 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,980 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,980 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#108]
2008-06-17 20:20:40,981 [main] DEBUG () NullableType: binding '108' to parameter: 1
2008-06-17 20:20:40,981 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#109]
2008-06-17 20:20:40,982 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,982 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,982 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#109]
2008-06-17 20:20:40,983 [main] DEBUG () NullableType: binding '109' to parameter: 1
2008-06-17 20:20:40,983 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#110]
2008-06-17 20:20:40,983 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,983 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,984 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#110]
2008-06-17 20:20:40,984 [main] DEBUG () NullableType: binding '110' to parameter: 1
2008-06-17 20:20:40,984 [main] DEBUG () AbstractEntityPersister: Inserting entity: [net.cellbell.model.T#111]
2008-06-17 20:20:40,984 [main] DEBUG () AbstractBatcher: reusing prepared statement
2008-06-17 20:20:40,985 [main] DEBUG () AbstractBatcher:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
Hibernate:
/* insert net.cellbell.model.T
*/ insert
into
T
(id)
values
(?)
2008-06-17 20:20:40,985 [main] DEBUG () AbstractEntityPersister: Dehydrating entity: [net.cellbell.model.T#111]
2008-06-17 20:20:40,986 [main] DEBUG () NullableType: binding '111' to parameter: 1
2008-06-17 20:20:40,986 [main] DEBUG () BatchingBatcher: Executing batch size: 11
2008-06-17 20:20:40,995 [main] DEBUG () AbstractBatcher: about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2008-06-17 20:20:40,995 [main] DEBUG () AbstractBatcher: closing statement
2008-06-17 20:20:40,995 [main] DEBUG () GooGooStatementCache: checkinStatement(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 1; num keys: 2
2008-06-17 20:20:40,996 [main] DEBUG () ConnectionManager: registering flush end
2008-06-17 20:20:40,996 [main] DEBUG () AbstractFlushingEventListener: post flush
2008-06-17 20:20:40,996 [main] DEBUG () JDBCContext: before transaction completion
2008-06-17 20:20:40,996 [main] DEBUG () SessionImpl: before transaction completion
2008-06-17 20:20:41,044 [main] DEBUG () JDBCTransaction: re-enabling autocommit
2008-06-17 20:20:41,045 [main] DEBUG () JDBCTransaction: committed JDBC Connection
2008-06-17 20:20:41,045 [main] DEBUG () JDBCContext: after transaction completion
2008-06-17 20:20:41,045 [main] DEBUG () ConnectionManager: aggressively releasing JDBC connection
2008-06-17 20:20:41,045 [main] DEBUG () ConnectionManager: releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2008-06-17 20:20:41,050 [main] DEBUG () GooGooStatementCache: checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 1; num keys: 2
2008-06-17 20:20:41,051 [main] DEBUG () BasicResourcePool: trace com.mchange.v2.resourcepool.BasicResourcePool@104a4b6 [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@b206e9)
2008-06-17 20:20:41,051 [main] DEBUG () SessionImpl: after transaction completion
2008-06-17 20:20:41,051 [main] DEBUG () PersistenceUtil: Closing EntityManager: org.hibernate.ejb.EntityManagerImpl@13c8540...
2008-06-17 20:20:41,052 [main] DEBUG () SessionImpl: closing session
2008-06-17 20:20:41,052 [main] DEBUG () ConnectionManager: connection already null in cleanup : no action
2008-06-17 20:20:41,051 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] DEBUG () GooGooStatementCache: checkinAll(): com.mchange.v2.c3p0.stmt.GlobalMaxOnlyStatementCache stats -- total size: 2; checked out: 0; num connections: 1; num keys: 2
2008-06-17 20:20:41,055 [main] DEBUG () PersistenceUtil: EntityManager: org.hibernate.ejb.EntityManagerImpl@13c8540 closed.
2008-06-17 20:20:41,055 [main] INFO () PersistenceUtil: Closing main EntityManagerFactory...
2008-06-17 20:20:41,056 [main] INFO () SessionFactoryImpl: closing
2008-06-17 20:20:41,058 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] DEBUG () ThreadPoolAsynchronousRunner$PoolThread: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main] interrupted. Shutting down.
2008-06-17 20:20:41,058 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] DEBUG () ThreadPoolAsynchronousRunner$PoolThread: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] interrupted. Shutting down.
2008-06-17 20:20:41,058 [main] DEBUG () ActiveManagementCoordinator: MBean: com.mchange.v2.c3p0:type=PooledDataSource[1hge11v7u163uw8e90ilzp|405f6] unregistered.
2008-06-17 20:20:41,059 [main] DEBUG () ActiveManagementCoordinator: C3P0Registry mbean unregistered.
2008-06-17 20:20:41,060 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] DEBUG () ThreadPoolAsynchronousRunner$PoolThread: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main] interrupted. Shutting down.
2008-06-17 20:20:41,062 [main] DEBUG () AbstractPoolBackedDataSource: com.mchange.v2.c3p0.PoolBackedDataSource@405f6 has been closed.
--
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
14 years, 5 months
[Hibernate-JIRA] Created: (ANN-850) Projection of composite key causes invalid SQL
by Dmitry Katsubo (JIRA)
Projection of composite key causes invalid SQL
----------------------------------------------
Key: ANN-850
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-850
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Hibernate Annotations 3.4.0.GA
Hibernate Commons Annotations 3.1.0.GA
Hibernate 3.3.1.GA
Reporter: Dmitry Katsubo
Priority: Minor
When using {{Projections.id()}} for the entity, which has a composite ID, the generated SQL is not valid. The expression {{select this_.conceptid as y0_this_.termid as y1_}} should be {{select this_.conceptid as y0_, this_.termid as y1_}} (comma is missed)
07 14:40:37 DEBUG [ConnectionManager] opening JDBC connection
07 14:40:37 DEBUG [SQL]
select
this_.conceptid as y0_this_.termid as y1_,
this_.text as y1_
from
term this_ limit ?
07 14:40:37 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
07 14:40:37 DEBUG [JDBCExceptionReporter] could not execute query [select this_.conceptid as y0_this_.termid as y1_, this_.text as y1_ from term this_]
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.termid as y1_, this_.text as y1_ from term this_ limit 1000' at line 1
Code:
{quote}
final Session session = sessionFactory.openSession();
try {
return session.createCriteria(TermImpl.class).setProjection(
Projections.projectionList().add(Projections.id()).add(Projections.property("text")))
.setMaxResults(1000).list();
} finally {
session.close();
}
{quote}
Mapped entity:
{quote}
@Entity
@Table(name = "term")
public class TermImpl implements Term, Serializable {
@Embeddable
public static class TermId implements Serializable {
private int id;
private Concept concept;
@Column(name = "termid")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@ManyToOne(targetEntity = ConceptImpl.class)
@JoinColumn(name = "conceptid")
@Fetch(FetchMode.SELECT)
public Concept getConcept() {
return concept;
}
public void setConcept(Concept concept) {
this.concept = concept;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TermId) {
TermId termId = (TermId) obj;
return id == termId.id && concept.equals(termId.concept);
}
return false;
}
@Override
public int hashCode() {
return id + concept.hashCode();
}
@Override
public String toString() {
final ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
builder.append("concept", concept);
builder.append("id", id);
return builder.toString();
}
}
private TermId id;
private String text;
@Id
public TermId getId() {
return id;
}
public void setId(TermId id) {
this.id = id;
}
@Transient
@Override
public Concept getConcept() {
return id.getConcept();
}
@Column(name = "text")
@Override
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TermImpl) {
final TermImpl term = (TermImpl) obj;
return id.equals(term.id);
}
return false;
}
@Override
public int hashCode() {
return id.hashCode();
}
@Override
public String toString() {
final ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
builder.append("id", id);
builder.append("text", text);
return builder.toString();
}
}
{quote}
Table structure:
{quote}
CREATE TABLE `term` (
`conceptid` int(11) NOT NULL,
`termid` int(10) unsigned NOT NULL,
`text` varchar(255) default NULL,
PRIMARY KEY (`conceptid`,`termid`)
);
{quote}
--
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
14 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1341) Query.setMaxResults does not work with Mysql Connector version 3.1.6, but works with 3.0.14
by Strong Liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1341?page=c... ]
Strong Liu commented on HHH-1341:
---------------------------------
I cant reproduce this issue with both hibernate 3.5.x and 3.3.2, with mysql connector 5.1.8.
I used the test org.hibernate.test.pagination.PaginationTest, you can found it in hibernate testsuite, please let me know if you can reproduce it and if possible, attache a runnable test case(pojo + hbm), thanks
> Query.setMaxResults does not work with Mysql Connector version 3.1.6, but works with 3.0.14
> -------------------------------------------------------------------------------------------
>
> Key: HHH-1341
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1341
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: Hibernate 3.1, Mysql Server 4.1.3, Mysql Connector 3.1.6 bzw. 3.0.14, JRE 1.5.0_06, winxp
> Reporter: Stefan Reger
> Assignee: Strong Liu
> Priority: Minor
>
> With Mysql Connector version 3.1.6: Setting query.setMaxResults(1000) results in console output:
> "Hibernate: select [...] limit ?
> 13:38:47,296 WARN JDBCExceptionReporter:71 - SQL Error: 1064, SQLState: 42000
> 13:38:47,296 ERROR JDBCExceptionReporter:72 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1"
> The query without setting the result limit succeeds.
> Mysql Connector 3.0.14 works perfectly. Please verify.
--
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
14 years, 5 months
[Hibernate-JIRA] Assigned: (HHH-1341) Query.setMaxResults does not work with Mysql Connector version 3.1.6, but works with 3.0.14
by Strong Liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1341?page=c... ]
Strong Liu reassigned HHH-1341:
-------------------------------
Assignee: Strong Liu
> Query.setMaxResults does not work with Mysql Connector version 3.1.6, but works with 3.0.14
> -------------------------------------------------------------------------------------------
>
> Key: HHH-1341
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1341
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: Hibernate 3.1, Mysql Server 4.1.3, Mysql Connector 3.1.6 bzw. 3.0.14, JRE 1.5.0_06, winxp
> Reporter: Stefan Reger
> Assignee: Strong Liu
> Priority: Minor
>
> With Mysql Connector version 3.1.6: Setting query.setMaxResults(1000) results in console output:
> "Hibernate: select [...] limit ?
> 13:38:47,296 WARN JDBCExceptionReporter:71 - SQL Error: 1064, SQLState: 42000
> 13:38:47,296 ERROR JDBCExceptionReporter:72 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1"
> The query without setting the result limit succeeds.
> Mysql Connector 3.0.14 works perfectly. Please verify.
--
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
14 years, 5 months