[Hibernate-JIRA] Created: (ANN-841) Bidirectional indexed collection mapped incorrectly for IndexedCollectionTest
by Gail Badner (JIRA)
Bidirectional indexed collection mapped incorrectly for IndexedCollectionTest
-----------------------------------------------------------------------------
Key: ANN-841
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-841
Project: Hibernate Annotations
Issue Type: Bug
Reporter: Gail Badner
Assignee: Emmanuel Bernard
Attachments: TEST-org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.xml
I believe that two bidirectional associations with indexed collections that use join tables are mis-mapped for org.hibernate.test.annotations.indexcoll.IndexedCollectionTest.
Mappings in AddressBook:
@MapKey
@OneToMany(mappedBy = "book", cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE})
@JoinTable(name="AddRegEntry")
public Map<AddressEntryPk, AddressEntry> getEntries() {
return entries;
}
@MapKey(name = "directory")
@OneToMany(mappedBy = "book")
@JoinTable(name="Dir_Entry")
public Map<AlphabeticalDirectory, AddressEntry> getDirectoryEntries() {
return directoryEntries;
}
Mappings in AddressEntry:
@ManyToOne
public AddressBook getBook() {
return book;
}
@ManyToOne
public AlphabeticalDirectory getDirectory() {
return directory;
}
AddRegEntry and Dir_Entry are not generated in the DDL and the CRUD operations do not reference the join tables.
Test output is attached.
--
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
[Hibernate-JIRA] Created: (HHH-4527) Implements @j.p.Access
by Emmanuel Bernard (JIRA)
Implements @j.p.Access
----------------------
Key: HHH-4527
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4527
Project: Hibernate Core
Issue Type: Sub-task
Components: annotations
Reporter: Emmanuel Bernard
Fix For: 3.5
2.3.1, 2.3.2
"the default access type is determined by the placement of mapping annotations on the
attributes of the entity classes and mapped superclasses of the entity hierarchy that do not explicitly
specify an access type"
"An access type for an individual entity class, mapped superclass, or embeddable class can be specified
for that class independent of the default for the entity hierarchy by means of the Access annotation
applied to the class. This explicit access type specification does not affect the access type of other entity
classes or mapped superclasses in the entity hierarchy."
"When Access(FIELD) is applied to such a class, it is possible to
selectively designate individual attributes within the class for property access. To specify a
persistent property for access by the persistence provider runtime, that property must be desig-
nated Access(PROPERTY) [...] Persistent state inherited from superclasses is accessed in accordance with the access types of
those superclasses."
"When Access(PROPERTY) is applied to such a class, it is possible to selectively designate indi-
vidual attributes within the class for instance variable access. To specify a persistent instance
variable for access by the persistence provider runtime, that instance variable must be desig-
nated Access(FIELD). Persistent state inherited from superclasses is accessed in accordance with the access types of
those superclasses. "
"The access type of an embeddable class is determined by the access type of the entity class, mapped
superclass, or embeddable class in which it is embedded (including as a member of an element collec-
tion) independent of whether the access type of the containing class has been explicitly specified or
defaulted. A different access type for an embeddable class can be specified for that embeddable class
by means of the Access annotation "
So in "summary":
- the default access type of a hierarchy is defined by where annotations are placed (id ideally) on classes that do not override access type
- the @Access type is not inherited to subclasses (the default access type for the hierarchy is inherited) **
- the access type of an embeddable or collection of embeddable, if not set explicitly is the one of its containing class (note the logic is different that in a hierarchy)
- the @Access annotation can be placed on a field to force field access on a class defaulted to property (and vice versa) *
* reverse behavior compared to @o.h.a.AccessType
** I think it's a different behavior than the current @AccessType annotation
If possible, keep support for the legacy @o.h.a.AccessType:
- it supports alternative access strategies
- it will keep legacy apps running :)
--
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
[Hibernate-JIRA] Created: (HHH-2993) NPE on org.hibernate.hql.ast.HqlSqlWalker, When Using explicit inner join on primitive type
by Vincent YSMAL (JIRA)
NPE on org.hibernate.hql.ast.HqlSqlWalker, When Using explicit inner join on primitive type
--------------------------------------------------------------------------------------------
Key: HHH-2993
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2993
Project: Hibernate3
Issue Type: Bug
Environment: Hibernate 3.2.5ga , oracle 10G, Windows
Reporter: Vincent YSMAL
Hi, trying to make an inne join on a primitve type cause an NPE.
java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:310)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3275)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
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:597)
at org.springframework.orm.hibernate3.HibernateTemplate$CloseSuppressingInvocationHandler.invoke(HibernateTemplate.java:1219)
Trying some HQL like this :
"from Cat as cat inner join cat.name as a0 " cause an NPE
--
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
[Hibernate-JIRA] Created: (HHH-4740) JPA 2 NOT IMPLEMENTED: @OneToMany with orphanRemoval
by Samuel Halliday (JIRA)
JPA 2 NOT IMPLEMENTED: @OneToMany with orphanRemoval
----------------------------------------------------
Key: HHH-4740
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4740
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.0-Beta-2
Reporter: Samuel Halliday
Attachments: WebJpa.zip
JPA 2 finally managed to fill the hole that @org.hibernate.annotations.Cascade(value=org.hibernate.annotations.CascadeType.DELETE_ORPHAN) was filling. Now @OneToMany has a (orphanRemoval = true) element - which should be trivial to implement in Hibernate 3.5 because it has exactly the same functionality as DELETE_ORPHAN.
However, to my surprise, 3.5 Beta 2 does not implement that much desired feature/fix of JPA 2.
The good news is that the corresponding @ManyToOne(optional = false) JPA 2 annotation seems to be working just dandy.
I've attached a failing J2EE Web Application to demonstrate the failure. One might need to test across sessions to ensure that the DELETE_ORPHAN behaviour is as expected. The application is a modification of the NetBeans Web JPA Sample project and is set up to run on a Glassfish v3 server with Hibernate 3.5 installed via the Update Tool. (i.e. assumes Hibernate is installed on the J2EE server).
To run the test, add an entry to the database through the web interface.
You can uncomment the line in the Person entity class to use DELETE_ORPHAN and see that the test case passes when using the hibernate extension.
--
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