[Hibernate-JIRA] Created: (HHH-5030) BaseRegionAdapter shouldn't rely on optional Cache#toMap method
by Adrian Hummel (JIRA)
BaseRegionAdapter shouldn't rely on optional Cache#toMap method
---------------------------------------------------------------
Key: HHH-5030
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5030
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.5.0-CR-2
Environment: hibernate-oscache 3.5.0.Beta-1
Reporter: Adrian Hummel
Attachments: bugreport.zip
Get an {{UnsupportedOperationException}} when checking the L2 cache if it contains an entity:
{code}
emf.getCache().contains(MyEntity.class, pk);
{code}
Result:
{code}
java.lang.UnsupportedOperationException
at org.hibernate.cache.OSCache.toMap(OSCache.java:126)
at org.hibernate.cache.impl.bridge.BaseRegionAdapter.contains(BaseRegionAdapter.java:62)
at org.hibernate.impl.SessionFactoryImpl$CacheImpl.containsEntity(SessionFactoryImpl.java:967)
at org.hibernate.impl.SessionFactoryImpl$CacheImpl.containsEntity(SessionFactoryImpl.java:962)
at org.hibernate.ejb.EntityManagerFactoryImpl$JPACache.contains(EntityManagerFactoryImpl.java:164)
...
{code}
The {{Cache#toMap}} method is optional (according to Javadoc), thus, {{BaseRegionAdapter}} shouldn't rely on this method.
--
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-4909) Null Pointer Exception When Usding Spring 3.0 with Hibernate 3.5.0-Beta-x
by Petar Tahchiev (JIRA)
Null Pointer Exception When Usding Spring 3.0 with Hibernate 3.5.0-Beta-x
-------------------------------------------------------------------------
Key: HHH-4909
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4909
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2, 3.5.0.Beta-1
Environment: Java, 1.6, Spring 3.0.0 (tested also with 3.0.1.SNAPSHOT)
Reporter: Petar Tahchiev
Priority: Critical
Attachments: stacktrace.txt
Hi guys,
I had an application working fine with OpenJPA, but I decided to migrate to Hibernate and I get a Null pointer exception (see the attached stacktrace).
Let me know if you need some other info. My configuration is below:
persistence.xml:
===========================================
===========================================
<?xml version="1.0" encoding="UTF-8"?>
<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="frontend-ui">
<class>com.fugsley.beech.betting.db.model.User</class>
.........[more here]...................
<!-- provider>org.hibernate.ejb.HibernatePersistence</provider>
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider-->
<properties>
<!-- OpenJPA configuration -->
<!-- property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/fugsley?useUnicode=true&characterEncoding=UTF-8"/>
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver"/>
<property name="openjpa.ConnectionUserName" value="fugsley"/>
<property name="openjpa.ConnectionPassword" value="r00tka"/>
<property name="openjpa.DetachState" value="DetachedStateField=true"/>
<property name="openjpa.Log" value="DefaultLevel=INFO, Tool=INFO"/> -->
<!-- configuration pool via c3p0-->
<property name="c3p0.acquire_increment" value="1"/>
<property name="c3p0.idle_test_period" value="100"/> <!-- seconds -->
<property name="c3p0.min_size" value="5"/>
<property name="c3p0.max_size" value="20"/>
<property name="c3p0.timeout" value="1800"/>
<property name="c3p0.max_statements" value="50"/>
<!-- Hibernate configuration -->
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.password" value="r00tka"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/fugsley?useUnicode=true&characterEncoding=UTF-8"/>
<property name="hibernate.connection.username" value="fugsley"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="300"/>
<property name="hibernate.c3p0.max_statements" value="50"/>
<property name="hibernate.c3p0.idle_test_period" value="3000"/>
</properties>
</persistence-unit>
</persistence>
===============spring-application-context===========================
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="loadTimeWeaver">
<bean
class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property>
<property name="dataSource" ref="beechDataSource" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="Mysql" />
<property name="showSql" value="false" />
</bean>
</property>
</bean>
--
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: (EJB-463) Merging of one-to-many relations not JPA spec compliant for lazy relations
by Dirk (JIRA)
Merging of one-to-many relations not JPA spec compliant for lazy relations
--------------------------------------------------------------------------
Key: EJB-463
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-463
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment: Hibernate 3.2.6, Hibernate EntityManager 3.4.0, Hibernate Annotations 3.4.0, Oracle
Reporter: Dirk
Attachments: CascadeTest.zip
Topic has been posted to the Hibernate Forum. See https://forum.hibernate.org/viewtopic.php?f=1&t=999398
Summary:
Suppose you have an object Master with one-to-many relation to Detail.
@Entity
public class Master implements Serializable {
@OneToMany(mappedBy = "master", cascade={CascadeType.MERGE, CascadeType.PERSIST})
private List<Detail> details = new ArrayList<Detail>();
...
}
Master is loaded without fetching Detail (= lazy) and EntityManager is closed. Master is now in detached state. Merging Master causes Hibernate EntityManager to eagerly load the Detail collection although it is in lazy state. This is not JPA spec compliant.
JPA spec states: The persistence provider must not merge fields marked LAZY that have not been fetched: it must ignore
such fields when merging. See 3.2.4.1 Merging Detached Entity State, p.51.
Tested also with the latest version of EclipseLink. EclipseLink behaves as expected.
Testcase attached (Netbeans 6.7).
--
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-3107) Error with sql generated for set of subclass A in a peer subclass B.
by Austin Mayberry (JIRA)
Error with sql generated for set of subclass A in a peer subclass B.
--------------------------------------------------------------------
Key: HHH-3107
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3107
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Reporter: Austin Mayberry
A mapping such as the following contrived examples does not yield the expected results and causes and error:
<class name="com.foo.Foo1" table="FOO1">
<id
name="id"
type="java.lang.Integer"
column="ID"
>
<generator class="sequence" >
<param name="sequence">ID_SEQ</param>
</generator>
</id>
<discriminator column="FOO_TYPE_ID" type="java.lang.Integer"/>
<subclass name="com.foo.Foo2" discriminator-value="0">
<join table="FOO2">
<key column="ID"/>
<property
name="label"
type="java.lang.String"
column="LABEL"
not-null="true"
length="255"
/>
</join>
<subclass name="com.foo.BarOne" discriminator-value="1">
<set
name="barTwos"
inverse="true"
>
<key>
<column name="PARENT_ID" />
</key>
<one-to-many class="com.foo.BarTwo" />
</set>
</subclass>
<subclass name="com.foo.BarTwo" discriminator-value="2">
<join table="BAR">
<key column="ID"/>
<many-to-one
name="parent"
class="com.foo.BarOne"
not-null="true"
column="PARENT_ID"
/>
</join>
</subclass>
</subclass>
</class>
The sql created to populate the set "bartwos" looks like this looks like:
select
bartwos0_.PARENT_ID as PA3_1_,
bartwos0_.ID as ID1_1_,
bartwos0_.ID as ID1_52_0_,
bartwos0_.FOO_TYPE_ID as FO2_52_0_,
bartwos0_1_.LABEL as LABEL76_0_,
bartwos0_2_.PARENT_ID as PA2_87_0_
from FOO1 bartwos0_, FOO2 bartwos0_1_, BAR2 bartwos0_2_
where bartwos0_.ID=bartwos0_1_.ID
and bartwos0_.ID=bartwos0_2_.ID
and bartwos0_.PARENT_ID=?
And yields the following error message:
java.sql.SQLException: ORA-00904: "BARTWOS0_"."PARENT_ID: invalid identifier
The basic problem is that it should be looking for the property PARENT_ID on BAR2, but it is looking for it on FOO1.
--
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-3752) Error with sql generated for set of subclass A in a peer subclass B.
by Austin Mayberry (JIRA)
Error with sql generated for set of subclass A in a peer subclass B.
--------------------------------------------------------------------
Key: HHH-3752
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3752
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.3.0.SP1, 3.3.0.GA, 3.3.0.CR2, 3.3.0.CR1, 3.2.6, 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.x, 3.3.x
Reporter: Austin Mayberry
A mapping such as the following contrived examples does not yield the expected results and causes and error:
<class name="com.foo.Foo1" table="FOO1">
<id
name="id"
type="java.lang.Integer"
column="ID"
>
<generator class="sequence" >
<param name="sequence">ID_SEQ</param>
</generator>
</id>
<discriminator column="FOO_TYPE_ID" type="java.lang.Integer"/>
<subclass name="com.foo.Foo2" discriminator-value="0">
<join table="FOO2">
<key column="ID"/>
<property
name="label"
type="java.lang.String"
column="LABEL"
not-null="true"
length="255"
/>
</join>
<subclass name="com.foo.BarOne" discriminator-value="1">
<set
name="barTwos"
inverse="true"
>
<key>
<column name="PARENT_ID" />
</key>
<one-to-many class="com.foo.BarTwo" />
</set>
</subclass>
<subclass name="com.foo.BarTwo" discriminator-value="2">
<join table="BAR">
<key column="ID"/>
<many-to-one
name="parent"
class="com.foo.BarOne"
not-null="true"
column="PARENT_ID"
/>
</join>
</subclass>
</subclass>
</class>
The sql created to populate the set "bartwos" looks like this looks like:
select
bartwos0_.PARENT_ID as PA3_1_,
bartwos0_.ID as ID1_1_,
bartwos0_.ID as ID1_52_0_,
bartwos0_.FOO_TYPE_ID as FO2_52_0_,
bartwos0_1_.LABEL as LABEL76_0_,
bartwos0_2_.PARENT_ID as PA2_87_0_
from FOO1 bartwos0_, FOO2 bartwos0_1_, BAR2 bartwos0_2_
where bartwos0_.ID=bartwos0_1_.ID
and bartwos0_.ID=bartwos0_2_.ID
and bartwos0_.PARENT_ID=?
And yields the following error message:
java.sql.SQLException: ORA-00904: "BARTWOS0_"."PARENT_ID: invalid identifier
The basic problem is that it should be looking for the property PARENT_ID on BAR2, but it is looking for it on FOO1.
I am refiling this bug because I originally only filed agains 3.2.4. It has been a year with no comments on it so I a resubmitting for all affected versions I have tried.
--
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-3748) foreign key attributed to wrong table when table for subclass with inheritance model is used
by Paul Pogonyshev (JIRA)
foreign key attributed to wrong table when table for subclass with inheritance model is used
--------------------------------------------------------------------------------------------
Key: HHH-3748
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3748
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.4
Environment: Tested with 3.3.1.GA + Oracle and 3.4 (trunk) + hsqldb.
Reporter: Paul Pogonyshev
Attachments: test.diff
When a collection of inherited objects (using table per subclass with discriminator model) is mapped, foreign key is always attributed to the base class table, not inherited class table. This means fields in inherited class tables are _unusable_ as keys for collections, or at least I don't see any way to use them.
This is a workaroundable issue for new databases (you could move the field to the base table, even if this is suboptimal), but a blocker for interfacing already existing database schemas.
I tried to create a testcase for this, attached is a diff against trunk. The test doesn't visibly fail, because I do not know how to check which table it references. However, you can see in ASTParserLoadingTest-output.txt:
create table DIBase (
id bigint generated by default as identity (start with 1),
type varchar(255) not null,
container bigint,
primary key (id)
)
create table DISubclass1 (
id bigint not null,
container bigint,
primary key (id)
)
I.e. field 'container' ends up in both base and derived class tables. Second is because of the 'many-to-one'. First is because foreign key from 'children' bag is attributed to a wrong table: instead, Hibernate should reuse the column in DISubclass1 table.
Might be related to issue 3500.
--
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-4761) Projection row count fails with MySQL causing paged results to fail
by Martijn Verburg (JIRA)
Projection row count fails with MySQL causing paged results to fail
-------------------------------------------------------------------
Key: HHH-4761
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4761
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: MySQL community 5.1.41 with latest J connector, running on Jboss 4.2.3.GA (Sun JDK 1.5.0_x), This case exists with MySQL, MySQL5 and MySQL5InnoDB dialects
Reporter: Martijn Verburg
Hi all
I have a piece of Java code that gets back a paged result set is as follows
// Lots of general criteria above this which generates the WHERE clause
..
..
criteria.setMaxResults(maxResults);
criteria.setFirstResult(firstResult);
criteria.addOrder(Order.desc("id"));
// Execute the actual search (**this works and brings back the expected list**)
List<WiretapEventHeader> wiretapResults = criteria.list();
// Now execute a std hibernate method to get the rowcount so we can page correctly
criteria.setProjection(Projections.rowCount());
Integer rowCount = 0;
List<Integer> rowCountList = criteria.list();
// BUG? We never go into this if case if we go beyond the first page
if (!rowCountList.isEmpty())
{
rowCount = rowCountList.get(0);
}
// Continuation of BUG? Always pass in 0 as rowCount when we go beyond the first page
return new PagedWiretapSearchResult(wiretapResults, rowCount, firstResult);
* The SQL it runs to perform a rowcount when listing the first page (which is successful) is:
select count(*) as y0_ from IkasanWiretap this_ where this_.ModuleName in (?, ?) order by this_.Id asc limit ?
* The SQL it runs to perform a rowcount when listing the subsequent pages (BUG? not successful) is:
select count(*) as y0_ from IkasanWiretap this_ where this_.ModuleName in (?, ?) order by this_.Id asc limit ?, ?
I simplified this down to the examples I gave the MySQL guys in http://bugs.mysql.com/bug.php?id=50005 and ran those from the MySQL query console, when providing the limit ?, ? case, you simply do not get back what I think are sensible results. In fact more often than not you get NULL list returned which causes the PagedWiretapSearchResult(wiretapResults, rowCount, firstResult) to execute with 0 rowCount which then returns a pagedResultSet with resultSize == 0
So I think Hibernate core needs to use alternative SQL to get the Projected rowcount from MySQL5
I've run the exact same code against Sybase without error.
Hope that all made sense, let me know if you need more details!
--
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