[Hibernate-JIRA] Created: (BVTCK-12) The TCK goes against the spec on Node and nested Path: section 4.2
by Emmanuel Bernard (JIRA)
The TCK goes against the spec on Node and nested Path: section 4.2
------------------------------------------------------------------
Key: BVTCK-12
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVTCK-12
Project: Bean Validation TCK
Issue Type: Bug
Affects Versions: 1.0.4.GA
Reporter: Emmanuel Bernard
Assignee: Emmanuel Bernard
Priority: Minor
In section 4.2 "Constraint Violation", Table 4.1, "propertyPath examples", the structure of a set of Path.Nodes is described. Examining the examples in this section:
Row 4 shows that a path describing the fourth author (i.e. "authors3") should be represented by a not-in-iterable "authors" node followed by a nameless node with index 3. However, in this example the TCK would expect a single "authors" node with index 3.
Likewise, row 6 shows that a path describing the first author's company property ("authors0.company") should be represented by a not-in-iterable "authors" node followed by a "company" node with index 0. In this example the TCK would instead expect an "authors" node with index 3, followed by a not-in-iterable "company" node.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5492) PostInsertListener doing new insert works on Mysql/HSQLDB, but not on Oracle.
by Barry (JIRA)
PostInsertListener doing new insert works on Mysql/HSQLDB, but not on Oracle.
-----------------------------------------------------------------------------
Key: HHH-5492
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5492
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.4
Environment: Oracle Database 10g Express Edition Release 10.2.0.1.0 and Oracle Database 11g Release 11.1.0.0.0
Reporter: Barry
Attachments: EventListener-test.zip
I'm trying to implement a hibernate event listener that inserts a new record every time a specific entity is updated, deleted or inserted. I've implemented a listener for post-insert, post-update, post-delete. Its a requirement that the new record is inserted in the same transaction as the one that originally triggered the update/deletion/insert.
The relevant section of my listener looks like this (similar for postInsert & postDelete):
{code}
public void onPostUpdate(PostUpdateEvent event) {
if (isAuditable(event.getEntity())) {
saveAuditRecord(event.getSession());
}
}
private boolean isAuditable(Object entity) {
return entity instanceof SomeEntity;
}
private void saveAuditRecord(Session session) {
AuditRecord record = new AuditRecord();
record.setId(Double.doubleToLongBits(Math.random()));
session.save(record);
}
{code}
The listener is triggered for each event, but it seems as though the AuditRecord is not saved when using an Oracle database. Using MySQL or HSQLDB works fine. So my guess is that it has something to do with the Oracle dialect?
I've attached a test case which demonstrates it failing (but you will need to connect to an Oracle DB :-)) Same result for Oracle XE and the full monty.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-3527) Null Version Comparator for versioned class due to reuse of Second Level CacheDataDescriptionImpl
by Paul FitzPatrick (JIRA)
Null Version Comparator for versioned class due to reuse of Second Level CacheDataDescriptionImpl
-------------------------------------------------------------------------------------------------
Key: HHH-3527
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3527
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.3.1
Environment: 3.3.1 GA, Postgres 8.3.3, EH Cache
Reporter: Paul FitzPatrick
Priority: Minor
When the SessionFactoryImpl constructor builds the EntityPersister for classes, it consults a cache of entityAccessStrategies for all the known second level cache regions. If only some of the classes in that region have version tags, then it is possible the cached EntityRegionAccessStrategy will be created without a Version Comparator. Subsequent calls to load an object using a Criteria query failed with a NullPointerException (stack trace below). The line being executed is "return version!=null && comparator.compare(version, newVersion) < 0;" and in this case "version" is an Integer object and comparator is null.
Not sure the appropriate solution. It would seem from an examination of the code that if the EntityRegionAccessStrategy is to be shared, then all classes in the second level cache region _must_ either all have a "version" column or all have no "version" column. Further, it seems implied that if they use a "version" column, then they must all use the exact same data type. If this is the case, then a better error check on the configuration data may be in order.
Caused by: java.lang.NullPointerException
at org.hibernate.cache.ReadWriteCache$Item.isPuttable(ReadWriteCache.java:426)
at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:180)
at org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter.putFromLoad(EntityAccessStrategyAdapter.java:68)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
at org.hibernate.loader.Loader.doQuery(Loader.java:752)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5764) AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId
by Karsten Wutzke (JIRA)
AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId
---------------------------------------------------------------------------------------------
Key: HHH-5764
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5764
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core, metamodel
Affects Versions: 3.6.0
Environment: Hibernate 3.6, JavaSE, HSQLDB, Ant (see SSCCE attached)
Reporter: Karsten Wutzke
Priority: Critical
Attachments: transmuc-hib-embeddedid-transitive-comp-pk-broken.zip
I have three tables:
CREATE TABLE PostAddresses
(
contact_id INTEGER NOT NULL,
ordinal_nbr SMALLINT NOT NULL,
PRIMARY KEY (contact_id, ordinal_nbr)
);
CREATE TABLE Foos
(
contact_id INTEGER NOT NULL,
ordinal_nbr SMALLINT NOT NULL,
PRIMARY KEY (contact_id, ordinal_nbr),
FOREIGN KEY (contact_id, ordinal_nbr) REFERENCES PostAddresses
(contact_id, ordinal_nbr)
);
CREATE TABLE Bars
(
contact_id INTEGER NOT NULL,
ordinal_nbr SMALLINT NOT NULL,
numba INTEGER NOT NULL,
PRIMARY KEY (contact_id, ordinal_nbr, numba),
FOREIGN KEY (contact_id, ordinal_nbr) REFERENCES Foos (contact_id,
ordinal_nbr)
);
Simple logic: Bars -> Foos -> PostAddresses all by (contact_id, ordinal_nbr),
whatever it means.
Here the six entity and respective composite key classes.
@Entity
@Table(name = "PostAddresses")
public class PostAddress implements Serializable
{
@EmbeddedId
private PostAddressId embeddedId;
...
}
@Embeddable
public class PostAddressId implements Serializable
{
@Column(name = "contact_id")
private Integer contactId;
@Column(name = "ordinal_nbr")
private Integer ordinalNbr = 1;
...
}
@Entity
@Table(name = "Foos")
public class Foo implements Serializable
{
@EmbeddedId
private FooId embeddedId;
@MapsId(value = "postAddressId")
@OneToOne
@JoinColumns(value = {@JoinColumn(name = "contact_id",
referencedColumnName = "contact_id"), @JoinColumn(name = "ordinal_nbr",
referencedColumnName = "ordinal_nbr")})
private PostAddress postAddress = null;
...
}
@Embeddable
public class FooId implements Serializable
{
@Embedded
private PostAddressId postAddressId; //just one field!
...
}
@Entity
@Table(name = "Bars")
public class Bar implements Serializable
{
@EmbeddedId
private BarId embeddedId;
...
}
@Embeddable
public class BarId implements Serializable
{
@Embedded
private FooId fooId;
@Column(name = "numba")
private Integer numba;
...
}
It's really nothing special, Bar references Foo, Foo references PostAddress,
all via composite key class. Since the foreign keys are composite and part of
the PK, I must nest the ID classes into the ID classes. I thought this is
correct. However, I get the following stack trace with Hibernate 3.6:
org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: tld.transmuc.model.Foo
at org.hibernate.cfg.CopyIdentifierComponentSecondPass.doSecondPass(CopyIdentifierComponentSecondPass.java:101)
at org.hibernate.cfg.Configuration.processSecondPassesOfType(Configuration.java:1424)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1388)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:278)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:362)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at tld.transmuc.Main.main(Main.java:27)
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: transmuc] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:374)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at tld.transmuc.Main.main(Main.java:27)
Caused by: org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: tld.transmuc.model.Foo
at org.hibernate.cfg.CopyIdentifierComponentSecondPass.doSecondPass(CopyIdentifierComponentSecondPass.java:101)
at org.hibernate.cfg.Configuration.processSecondPassesOfType(Configuration.java:1424)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1388)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1345)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1477)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1096)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:278)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:362)
... 4 more
Hibernate is telling me about a problem with the @MapsId annotation and the Foo class:
org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: tld.transmuc.model.Foo
It appears to be a bug. Even if I omit the @Embedded annotation from the ID classes, the exception is still there.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5763) StackOverflowException on a HQL with too many "or".
by Björn Schmitz (JIRA)
StackOverflowException on a HQL with too many "or".
---------------------------------------------------
Key: HHH-5763
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5763
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.5.5
Environment: - Hibernate Core 3.5.5
- Hades 2.0.0
- MySQL
Reporter: Björn Schmitz
Hi.
I generated with Hades following HQL statement:
"DELETE FROM Foo x WHERE x = ?1 OR x = ?2 OR x = ?n"
If i try to delete a list with over 18,000 elements, Hades generates a statement with 17,999 "OR".
This throws following Exception:
{{Caused by: java.lang.StackOverflowError
at java.util.HashMap.get(HashMap.java:300)
at org.hibernate.hql.ast.util.ASTPrinter.getTokenTypeName(ASTPrinter.java:139)
at org.hibernate.hql.ast.HqlSqlWalker.buildTraceNodeName(HqlSqlWalker.java:191)
at org.hibernate.hql.ast.HqlSqlWalker.traceIn(HqlSqlWalker.java:186)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1811)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1859)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1859)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1859)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1859)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1859)
[...]}}
I've posted this bug in the bugtracker of Hades, too. But it seems to be a hibernate bug.
http://redmine.synyx.org/issues/414
Regards
Björn
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5202) polymorphism=PolymorphismType.EXPLICIT not work
by zhuzhangsuo (JIRA)
polymorphism=PolymorphismType.EXPLICIT not work
------------------------------------------------
Key: HHH-5202
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5202
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.5.1
Environment: hibernate3.5.1 mysql 5.1
Reporter: zhuzhangsuo
Attachments: src.rar
class Book ,Section is Inheritanced from EntityItem and use @Inheritance(strategy=InheritanceType.JOINED)
I want to use @org.hibernate.annotations.Entity(dynamicUpdate=true,selectBeforeUpdate=true, polymorphism=PolymorphismType.EXPLICIT) to select the base table into EntityItem but not Book or Section
The sql is : select entityitem0_.entity_id as entity1_0_, entityitem0_.entity_author as entity2_0_, entityitem0_.entity_category as entity3_0_, entityitem0_.entity_ctime as entity4_0_, entityitem0_.entity_desc as entity5_0_, entityitem0_.entity_folder as entity6_0_, entityitem0_.entity_keyword as entity7_0_, entityitem0_.entity_name as entity8_0_, entityitem0_.entity_operator as entity9_0_, entityitem0_.entity_order as entity10_0_, entityitem0_.entity_pid as entity18_0_, entityitem0_.entity_picture as entity11_0_, entityitem0_.entity_status as entity12_0_, entityitem0_.entity_tag as entity13_0_, entityitem0_.entity_template as entity14_0_, entityitem0_.entity_type as entity15_0_, entityitem0_.entity_update_time as entity16_0_, entityitem0_.entity_url as entity17_0_, entityitem0_1_.section_content as section1_1_, entityitem0_2_.book_continue as book1_2_, entityitem0_2_.book_copyright as book2_2_, entityitem0_2_.book_grade as book3_2_, entityitem0_2_.book_press as book4_2_, entityitem0_2_.book_price as book5_2_, entityitem0_2_.book_pv as book6_2_, entityitem0_2_.book_translate as book7_2_, case when entityitem0_1_.entity_id is not null then 1 when entityitem0_2_.entity_id is not null then 2 when entityitem0_.entity_id is not null then 0 end as clazz_ from book_entity entityitem0_ left outer join book_section_detail entityitem0_1_ on entityitem0_.entity_id=entityitem0_1_.entity_id left outer join book_detail entityitem0_2_ on entityitem0_.entity_id=entityitem0_2_.entity_id
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5762) Consider whether new ClassMetadata.getIdenifier(Object, SessionImplementor) is correct
by Mike Q (JIRA)
Consider whether new ClassMetadata.getIdenifier(Object, SessionImplementor) is correct
--------------------------------------------------------------------------------------
Key: HHH-5762
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5762
Project: Hibernate Core
Issue Type: Task
Components: core
Affects Versions: 3.6.0
Reporter: Mike Q
I recently upgraded from 3.3.2 to 3.6.0. On doing I noticed the ClassMetadata.getIdentifier(Object, EntityMode) interface method was deprecated and had been replaced by ClassMetadata.getIdentifier(Object, SessionImplementor). This equally applies to setIdentifier and instantiate.
This was confusing because I was always under the impression that ClassMetadata is a public API to be used for introspection of the hibernate model and reflective manipulation of entities. ie It might easily be used by application code.
Conversely I always thought that SessionImplementor was an internal API that I might interact with when writing my own EventListeners or UserTypes but general day to day use would never see this.
If my above impressions are correct then it seems wrong that a public API, ClassMetadata, has methods that require an internal/private API, SessionImplementor. When working with the hibernate public API I have no way of getting a SessionImplementor other than "knowing" that I can cast a Session, but that will break if anything ever proxies a Session for some reason.
Anyways I would like someone to consider whether the above method changes are a good thing for the hibernate API. From the PoV of someone who uses the ClassMetadata API a fair amount I would say they are not as I now have to make dangerous (casting) assumptions in my code. But I don't know the full reasons for this change so I might be missing something.
--
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, 10 months