[Hibernate-JIRA] Created: (EJB-408) c3p0 not working with hibernate-entitymanager 3.4.0.GA
by Marcelo Romulo Fernandes (JIRA)
c3p0 not working with hibernate-entitymanager 3.4.0.GA
------------------------------------------------------
Key: EJB-408
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-408
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Environment: windows xp sp2; java sun 1.6.0_10; tomcat 6.0.18; maven 2.0.9
Reporter: Marcelo Romulo Fernandes
Priority: Minor
I was using hibernate-entitymanager 3.2.6.GA and c3p0 well, but I cannot run c3p0 with hibernate-entitymanager 3.4.0.GA. c3p0 is never called!!!
Below, follows persistence.xml, maven dependencies working with hibernate-entitymanager 3.2.6.GA, maven dependencies not woking with hibernate-entitymanager 3.4.0.GA
persistence.xml:
<persistence version="1.0" 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 http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="SystemDDD" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<!-- Connection properties -->
<property name="hibernate.connection.username" value="DDD"/>
<property name="hibernate.connection.password" value="DDD"/>
<property name="hibernate.default_schema" value="DDD"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@//YYY:1521/ZZZ"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
<!-- Connection pooling properties -->
<property name="hibernate.c3p0.min_size" value="1"/>
<property name="hibernate.c3p0.max_size" value="10"/>
<property name="hibernate.c3p0.timeout" value="5000"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="60000"/>
<!-- Cache properties -->
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<!-- Other properties -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.hbm2ddl.auto" value="none"/>
</properties>
</persistence-unit>
</persistence>
maven dependencies working with hibernate-entitymanager 3.2.6.GA
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
maven dependencies not woking with hibernate-entitymanager 3.4.0.GA
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.4.0.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.3.0.SP1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.2</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.3.0.SP1</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
What is wrong or missing?
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-2460) Multiple object creates on HQL select causes "unexpected token: ,"
by Steve Mayhew (JIRA)
Multiple object creates on HQL select causes "unexpected token: ,"
------------------------------------------------------------------
Key: HHH-2460
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2460
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.1.2
Environment: MySQL
Reporter: Steve Mayhew
When executing this query:
select new java.lang.String('test1'), new java.lang.String('test2')
from SomeMappedClass
You get a syntax error. It does not matter what is in the from clause, result is always the same.
[2007-03-01 16:51:29,349] [ERROR:org.hibernate.hql.PARSER] [] - line 1:37: unexpected token: ,
[2007-03-01 16:51:29,365] [DEBUG:org.hibernate.hql.ast.AST] [] - --- HQL AST ---
\-[QUERY] 'query'
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: , near line 1, column 37 [select new java.lang.String('test1'), new java.lang.String('test2')
from SomeMappedClass
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602)
at net.jvnet.dev.hqe.ThreadHQLQueryExecution.run(Unknown Source)
Caused by: line 1:37: unexpected token: ,
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1145)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:702)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:238)
... 9 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-3494) HQLQueryPlan gives back zero result for "getSingleResult()" although one result is available
by Christian Hofschroer (JIRA)
HQLQueryPlan gives back zero result for "getSingleResult()" although one result is available
--------------------------------------------------------------------------------------------
Key: HHH-3494
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3494
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.1
Environment: 3.3.1.GA, hsqldb 1.8.0.7
Reporter: Christian Hofschroer
Attachments: patch.txt
I have run the following code snippets both and only the second one works, because there is a bug in HQLQueryPlan.
// This does not work correctly (query is javax.persistence.Query)
ExampleObject e = (ExampleObject) query.getSingleResult();
// Replacement with this code works
List l=query.getResultList() ;
assertEquals(1,l.size()) ;
ExampleObject e=(ExampleObject)l.get(0) ;
This problem occurs only in seldom cases when
1. Hibernate executes several sql queries and merges the result
and
2. There is a limit of results (the limit is "2" in version 3.3.1.GA, because only one result is expected anyway)
Attached is a patch for the class HQLQueryPlan. The line
if ( distinction.add( result ) ) {
has to be replaced with
if ( ! distinction.add( result ) ) {
In case the object was found it returns "true". With the current implementation the object is not added to "combinedResults" although it should be added.
It was not possible to reproduce the problem with the setup from "testsuite". If necessary I can provide a JUnit testcase.
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (HHH-3121) Using fetch="subselect" and second level cache causes NullPointerException
by Adam Brod (JIRA)
Using fetch="subselect" and second level cache causes NullPointerException
--------------------------------------------------------------------------
Key: HHH-3121
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3121
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.6
Environment: Oracle 10g
Reporter: Adam Brod
I've been tuning some of our mappings to use fetch="subselect" to reduce the number of DB queries. However, I have run into two cases where I get the exception below. In both cases, I was loading a list of Videos, which are mapped to a list of other objects. (In this example, Media is the superclass of Video.) I apologize that I can't upload a full working example, but I will include the relevant mapping info.
<class name="Media" table="media" lazy="false" discriminator-value="0">
<cache usage="nonstrict-read-write"/>
<id name="id" column="id" type="long">
<generator class="seqhilo"><param name="sequence">hibernate_hi_sequence</param><param name="max_lo">500</param></generator>
</id>
...
<list name="tags" lazy="true" table="media_tags" cascade="save-update" fetch="subselect">
<cache usage="nonstrict-read-write"/>
<key column="media_id"/>
<list-index column="idx"/>
<many-to-many column="tag_id" class="com.brightcove.catalog.Tag"/>
</list>
...
<subclass name="Video" lazy="false" discriminator-value="1">
...
</subclass>
</class>
<class name="Tag" table="tag">
...
</class>
The HQL being executed is just a simple "from Video v where v.publisher_id = :pubId".
The line of code where the exception is generated in Video.getDTO() is accessing the Tags list:
for (Tag tag : getTags()) {
tags.add(tag.getDTO());
}
I've debugged into the Hibernate source to see where the NPE comes from (CollectionLoadContext line 298).
if ( persister.isVersioned() ) {
versionComparator = persister.getOwnerEntityPersister().getVersionType().getComparator();
final Object collectionOwner = getLoadContext().getPersistenceContext().getCollectionOwner( lce.getKey(), persister );
version = getLoadContext().getPersistenceContext().getEntry( collectionOwner ).getVersion(); //NPE!
}
It seems that "collectionOwner" is null, so calling getEntry(collectionOwner) returns null. Calling getVersion() on a null entry is what throws the NPE.
java.lang.NullPointerException
at org.hibernate.engine.loading.CollectionLoadContext.addCollectionToCache(CollectionLoadContext.java:298)
at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollection(CollectionLoadContext.java:256)
at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:222)
at org.hibernate.engine.loading.CollectionLoadContext.endLoadingCollections(CollectionLoadContext.java:195)
at org.hibernate.loader.Loader.endCollectionLoad(Loader.java:877)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:865)
at org.hibernate.loader.Loader.doQuery(Loader.java:729)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.loadCollectionSubselect(Loader.java:2066)
at org.hibernate.loader.collection.SubselectCollectionLoader.initialize(SubselectCollectionLoader.java:58)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109)
at org.hibernate.collection.PersistentList.size(PersistentList.java:91)
at com.brightcove.catalog.EconomicEntity.populateDTO(EconomicEntity.java:460)
at com.brightcove.catalog.Media.populateDTO(Media.java:192)
at com.brightcove.catalog.Video.populateDTO(Video.java:854)
at com.brightcove.catalog.Video.getDTO(Video.java:783)
at com.brightcove.catalog.Video.getDTO(Video.java:756)
--
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
13 years, 9 months
[Hibernate-JIRA] Created: (ANN-687) orm.xml - cleanup respecting column names
by darren hartford (JIRA)
orm.xml - cleanup respecting column names
-----------------------------------------
Key: ANN-687
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-687
Project: Hibernate Annotations
Issue Type: Bug
Components: binder
Affects Versions: 3.3.0.ga
Environment: mysql 5, MS SQL 2000, Win2000, hibernate 3.2.4
Reporter: darren hartford
couple of issues with orm.xml mapping file that is not fully implemented and needs cleanup.
many-to-many table mapping not respecting column names.
http://forum.hibernate.org/viewtopic.php?t=982330
id-class not respecting column names (end of an old issue, repeated with different scenario).
http://opensource.atlassian.com/projects/hibernate/browse/ANN-361
<id-class class="MyTestId"/>
<attributes>
<id name="compoundOne">
<column name="COMPOUND_ONE"/>
</id>
<id name="compoundTwo">
<column name="COMPOUND_TWO"/>
</id>
...
WARNING: Preparing the statement failed: Invalid column name 'compoundOne'.
WARNING: Preparing the statement failed: Invalid column name 'compoundTwo'.
==========
Use case and urgency of issue related to external technology integration.
-DTO should not require hibernate-annotations to be used in client-code, but is required when using annotations. orm.xml approach removes this limitation.
-GWT 1.4 does not work with java 1.5/annotated DTO. Although everyone keeps pushing it off saying 'GWT 1.5 is on the way', it is not and solutions that should have been working to work around that limitation need to be working correctly.
--
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
13 years, 10 months
[Hibernate-JIRA] Created: (ANN-472) @UniqueConstraint declaration is not friendly towards inheritance or reflection
by Ted Bergeron (JIRA)
@UniqueConstraint declaration is not friendly towards inheritance or reflection
-------------------------------------------------------------------------------
Key: ANN-472
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-472
Project: Hibernate Annotations
Type: Improvement
Versions: 3.2.0.ga
Environment: Hibernate 3.2 GA
Reporter: Ted Bergeron
The current way to define a composite unique constraint is limiting.
@Table(name="tbl_sky",
uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}
)
Suppose I have an abstract base class called A that gives me Id and Name, subclassed by abstract class B that gives me Customer. Then I have many concrete classes that subclass B. For all of these, I'd want the combination of Name and Customer to be unique. As I do not use @Table with abstract base classes, I currently have to repeat: uniqueConstraints = {@UniqueConstraint(columnNames={"name", "customer_id"})} on all concrete classes.
If we had an alternate way to define these constraints at the property level (as XDoclet did with hibernate 2), I could define this in the base classes and inherit the constraint declaration.
The other need is that I would like to use reflection to scan the properties and apply proper validations in the view layer. With @Column(unique = true) this is easy to do. The view layer makes an AJAX call and all is well. For a composite constraint, it does not work well currently.
--
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
13 years, 10 months