[Hibernate-JIRA] Created: (HV-28) "connection already null in cleanup" when using validators
by David J. M. Karlsen (JIRA)
"connection already null in cleanup" when using validators
----------------------------------------------------------
Key: HV-28
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-28
Project: Hibernate Validator
Issue Type: Bug
Environment: hibernate annotations 3.3.0ga
hibernate validator 3.0.0ga
hibernate 3.2.4.sp1
hibernate-commons-annotations 3.3.0.ga
Reporter: David J. M. Karlsen
Priority: Critical
2007-06-27 21:18:39,133 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 11829719154 (SessionImpl.java:220)
2007-06-27 21:18:39,159 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.DefaultSaveOrUpdateEventListener - saving transient instance (DefaultSaveOrUpdateEventListener.java:158)
2007-06-27 21:18:39,162 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.event.def.AbstractSaveEventListener - generated identifier: e2632934-a800-4a91-a9ff-ce8e1f95a03d, using strategy: org.hibernate.id.Assigned (AbstractSaveE
ventListener.java:112)
2007-06-27 21:18:39,168 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractSaveEventListener - saving [mypackage.server.types.Fee#e2632934-a800-4a91-a9ff-ce8e1f95a03d] (AbstractSaveEventListener.java:
153)
2007-06-27 21:18:39,228 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractFlushingEventListener - flushing session (AbstractFlushingEventListener.java:58)
2007-06-27 21:18:39,232 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - processing flush-time cascades (AbstractFlushingEventListener.java:111)
2007-06-27 21:18:39,237 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - dirty checking collections (AbstractFlushingEventListener.java:154)
2007-06-27 21:18:39,238 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractFlushingEventListener - Flushing entities and processing referenced collections (AbstractFlushingEventListener.java:171)
2007-06-27 21:18:39,249 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractFlushingEventListener - Processing unreferenced collections (AbstractFlushingEventListener.java:210)
2007-06-27 21:18:39,251 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates (AbstractFlushingEventListener.java:224)
2007-06-27 21:18:39,252 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects (AbstractFlushingEventListener.java:85)
2007-06-27 21:18:39,254 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.event.def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections (AbstractFlushingEventListener.java:91)
2007-06-27 21:18:39,260 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.pretty.Printer - listing entities: (Printer.java:83)
2007-06-27 21:18:39,262 [WorkManager.DefaultWorkManager : 0] DEBUG org.hibernate.pretty.Printer - mypackage.types.Fee{<values anonymized>} (Printer.java:90)
2007-06-27 21:18:39,264 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.event.def.AbstractFlushingEventListener - executing flush (AbstractFlushingEventListener.java:290)
2007-06-27 21:18:39,265 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.jdbc.ConnectionManager - registering flush begin (ConnectionManager.java:469)
2007-06-27 21:18:39,276 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.jdbc.ConnectionManager - registering flush end (ConnectionManager.java:478)
2007-06-27 21:18:39,278 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.impl.SessionImpl - after transaction completion (SessionImpl.java:422)
2007-06-27 21:18:39,280 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.impl.SessionImpl - closing session (SessionImpl.java:273)
2007-06-27 21:18:39,281 [WorkManager.DefaultWorkManager : 0] TRACE org.hibernate.jdbc.ConnectionManager - connection already null in cleanup : no action (ConnectionManager.java:375)
2007-06-27 21:18:39,298 [WorkManager.DefaultWorkManager : 0] ERROR Could not insert Fee
org.hibernate.validator.InvalidStateException: validation failed for: mypackage.server.types.Fee
at org.hibernate.validator.event.ValidateEventListener.validate(ValidateEventListener.java:148)
at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172)
at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:156)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:49)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
This only seems to happen when I'm running inside an appserver (WebSphere 6.1) with pooled connections - in my unit-tests using a org.springframework.jdbc.datasource.DriverManagerDataSource (eg. non-pooled) it works OK - and only if adding validating annotations (@NotEmpty)
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-2524) Criteria query with collection of values (Set<java.lang.String>)
by marco molinari (JIRA)
Criteria query with collection of values (Set<java.lang.String>)
----------------------------------------------------------------
Key: HHH-2524
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2524
Project: Hibernate3
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.2.2
Environment: Java VM : 1.5.0_07
DBMS : HSQLDB
Hibernate: hibernate-3.2.2.ga
Reporter: marco molinari
Hi to all,
I have a problem with Criteria query on collection of values.
Below I wrote a piece of java code and a piece of Person.hbm.xml.
I want to search all persons with the email addresses containing character '@'.
I obtain an empty list of Person and the SQL created by Criteria seems not correct ( more or less ... WHERE lower(PERSON_ID) ? ).
I search information inside Hibernate site and Hibernate book but I didn't found the solution.
public class Person
{
private Long id;
private Set<String> emailAddresses = new HashSet();
public Set<String> getEmailAddresses()
{
return emailAddresses;
}
public void setEmailAddresses(Set<String> emailAddresses) {
this.emailAddresses = emailAddresses;
}
}
public static void main(String[] args)
{
List<Person> list = session.createCriteria(Person.class)
.add( Restrictions.ilike( "emailAddresses", "@", MatchMode.ANYWHERE ) )
.list();
}
Piece of Person.hbm.xml:
<set name="emailAddresses" table="'PERSON_EMAIL_ADDR'" inverse="true">
<key column="'PERSON_ID'"/>
<element column="'EMAIL_ADDR'" type="java.lang.String" not-null="true"/>
</set>
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-2650) Allow for an entire Session to be readOnly, add Session.setReadOnly() method
by Gunther Schadow (JIRA)
Allow for an entire Session to be readOnly, add Session.setReadOnly() method
----------------------------------------------------------------------------
Key: HHH-2650
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2650
Project: Hibernate3
Issue Type: Sub-task
Components: core
Environment: Any
Reporter: Gunther Schadow
There is a need for read-only applications to avoid any snapshoting of objects if that application never intends to make updates. Such readOnly mode would be the mode in which any object gets loaded into the session, whether directly or from lazy collections. The use case is reporting applications which want to make sure that they don't even accidentally make updates AND that want to save the time it takes to create snapshots because they read through a lot of data very quickly. Our own need is that we have a rich client where we hold read only sessions open for browsing and where we spawn off any change transactions into separate Sessions. Even in change transactions we like to have all objects locked from even accidental updates unless they are explicitly unlocked.
A Session.setReadOnly() method would be ideal to do this. It does not appear very hard to make that improvement. We would do it ourselves even if we had some idea if (and under which criteria) our modifications would have a chance to make it into future versions of Hibernate?
--
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, 11 months
[Hibernate-JIRA] Created: (ANN-632) @IndexColumn doesn't set value of index column
by Dan Allen (JIRA)
@IndexColumn doesn't set value of index column
----------------------------------------------
Key: ANN-632
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-632
Project: Hibernate Annotations
Issue Type: Bug
Components: documentation
Affects Versions: 3.3.0.ga
Reporter: Dan Allen
I'm sure I will get screamed at for this, but the @IndexColumn just doesn't work with @OneToMany. When I say it doesn't work, it means that I am a reasonable person and I have studied the documentation for at least 4 hours and I just cannot figure out how to make it work. So either the documentation needs to be improved, or there is something wrong with Hibernate. I refuse to believe that I am this stupid.
Here is my problem in a nutshell. I have a Person and a collection of Jobs. The Jobs should be an indexed list based on the history that the person holds them.
@Entity
public class Person {
@Id @GeneratedValue
private long id;
@Column
private String name;
@OneToMany(cascade=ALL, fetch=LAZY, mappedBy = "job")
@IndexColumn(base = 1, name = "order")
private List<Job> jobs = new ArrayList<Job>();
// getters and setters
}
@Entity
public class Job {
@Id @GeneratedValue
private long id;
@Column
private String name;
@ManyToOne
@JoinColumn(name="person_id")
private Person person;
@Column
private Integer order;
// getters and setters
}
If I do the following, I get NULL for order.
Person person = new Person();
person.setName("Chuck")
Job job1 = new Job();
job1.setName("sysadmin")
job1.setPerson(person);
person.getJobs().add(job1);
Job job2 = new Job();
jobs2.setName("network admin")
job2.setPerson(person);
person.getJobs().add(job2);
entityManager.persist(person);
Assume that the reason I am not assigning an order is more complex than this example. The point is that we want to see the order column populated with the index of the list.
Now, if you give me the business about removing mappedBy, to that I will respond that by removing mappedBy, Hibernate tries to work with a person_job table, which I don't want. I want two tables, one for person and one for job.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2622) CLONE -Fields quetes must be applied in queries to prevent mix reserved words with fields names
by Igor A Tarasov (JIRA)
CLONE -Fields quetes must be applied in queries to prevent mix reserved words with fields names
-----------------------------------------------------------------------------------------------
Key: HHH-2622
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2622
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.0 cr1
Environment: MySQL 4.1.16 Hibernate 3.2 cr1 Fedora Core 4
Reporter: Igor A Tarasov
Quotes must be appied to fields in queries.
The environment log is:
org.hibernate.cfg.Environment Hibernate 3.2 cr1
org.hibernate.cfg.SettingsFactory RDBMS: MySQL, version: 4.1.16
org.hibernate.cfg.SettingsFactory JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.12
org.hibernate.dialect.Dialect Using dialect: org.hibernate.dialect.MySQLDialect
I have an entity, named Group:
@Entity
public class Group {
..
}
But, 'GROUP' is the reserved word of MySQL query language.
Log of hibernate show, that queries is without quotes:
org.hibernate.persister.entity.AbstractEntityPersister Static SQL for entity: org.dicr.isp.entity.Group
org.hibernate.persister.entity.AbstractEntityPersister Version select: select id from Group where id =?
org.hibernate.persister.entity.AbstractEntityPersister Snapshot select: select group_.id, group_.name as name0_, group_.comment as comment0_ from Group group_ where group_.id=?
org.hibernate.persister.entity.AbstractEntityPersister Insert 0: insert into Group (name, comment, id) values (?, ?, ?)
org.hibernate.persister.entity.AbstractEntityPersister Update 0: update Group set name=?, comment=? where id=?
org.hibernate.persister.entity.AbstractEntityPersister Delete 0: delete from Group where id=?
org.hibernate.persister.entity.AbstractEntityPersister Identity insert: insert into Group (name, comment) values (?, ?)
And this make a critical error in program logic:
org.hibernate.tool.hbm2ddl.DatabaseMetadata table not found: Group
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate Unsuccessful: create table Group (id bigint not null auto_increment, name varchar(255) not null unique, comment varchar(255), primary key (id))
ERROR org.hibernate.tool.hbm2ddl.SchemaUpdate 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 'Group (id bigint not null auto_increment, name varchar(255) not null unique, com' at line 1
[2006-04-27 23:57:23,895] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate schema update complete
The query: "create table Group (id bigint ..." is not correct.
Must be: "create table `Group` (`id` bigint ..."
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2354) Schema validation too rigid for MySql enums
by Zeljko Trogrlic (JIRA)
Schema validation too rigid for MySql enums
-------------------------------------------
Key: HHH-2354
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2354
Project: Hibernate3
Type: Bug
Components: metamodel
Environment: jboss-seam-1.1.0.GA, MySQL 5
Reporter: Zeljko Trogrlic
Enum column type in MySQL is handled as CHAR in their JDBC driver and should be mapped to String Java type.
However, Hibernate expects varchar(n) and fails to do the validation.
This is how DatabaseMetaData.getColumns describes it:
DATA_TYPE=1
TYPE_NAME=enum
Note that although TYPE_NAME is enum, DATA_TYPE represents CHAR.
Hibernate reports following exception:
13:49:31,397 INFO [TableMetadata] table found: configuration.userdb_domain_acl
13:49:31,397 INFO [TableMetadata] columns: [id, enabled, tablename, domain]
13:49:31,397 WARN [ServiceController] Problem starting service persistence.units:ear=msmgui.ear,unitName=msmgui
javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: enabled, expected: varchar(
2)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Validation should be fixed/relaxed to avoid this problem.
--
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, 11 months
[Hibernate-JIRA] Created: (EJB-277) allow string values for query hints
by Norman Richards (JIRA)
allow string values for query hints
-----------------------------------
Key: EJB-277
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-277
Project: Hibernate Entity Manager
Type: Improvement
Reporter: Norman Richards
It seems that some string values are not accepted as query hint values in hibernate. In specific, I was trying to convert a simple query that uses setHint("org.hibernate.cacheable", true) to use an XML-defined EntityQuery that uses
<framework:entity-query name="allCategories"
ejbql="select c from Category c"
order="c.name">
<framework:hints>
<key>org.hibernate.cacheable</key>
<value>true</value>
</framework:hints>
</framework:entity-query>
Unfortunately, this fails with an IllegalArgumentException:
Caused by: java.lang.IllegalArgumentException: Value for hint
at org.hibernate.ejb.QueryImpl.setHint(QueryImpl.java:160)
at org.jboss.seam.framework.EntityQuery.createQuery(EntityQuery.java:114)
at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:41)
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)
...
Although I didn't try it, I would assume this would also fail from a @QueryHint in on a named query since that annotation only accepts a string
value.
I don't think this is technically a bug, but it would be very convenient if all the hints could accept string values.
--
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, 11 months
[Hibernate-JIRA] Created: (HHH-2077) Providing an escape sequence for Criteria queries
by Tobias Dietl (JIRA)
Providing an escape sequence for Criteria queries
-------------------------------------------------
Key: HHH-2077
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2077
Project: Hibernate3
Type: Improvement
Components: query-criteria
Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4
Environment: Hibernate 3.1.3, MySQL, HSQLDB, Oracle
Reporter: Tobias Dietl
Up to now, there is no way of setting the escape sequence to use for string comparisions with like for Criteria queries.
This is necessary as MySQL on the one hand and HSQLDB / Oracle on the other behave differently...
If you want to search for '_abc' in MySQL, you have to use:
value like '\\_abc'
In Oracle or HsqlDB, you have to use:
value like '\_abc'
If you want to switch to another escape sequence like '|' , you can set it in HQL with value like '|_abc' escape '|'. Unfortunately, there is no way of setting it for Criteria queries, which would force me to rewrite all my Criteria queries in HQL. It would really be nice if the feature/improvement would be added...
--
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
16 years