[Hibernate-JIRA] Created: (HHH-4924) Unnecessary "left outer join". Probably this "left outer join" can be eliminated. OneToOne when optional=true and LAZY
by Adam Wozniak (JIRA)
Unnecessary "left outer join". Probably this "left outer join" can be eliminated. OneToOne when optional=true and LAZY
----------------------------------------------------------------------------------------------------------------------
Key: HHH-4924
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4924
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.1
Environment: n/a
Reporter: Adam Wozniak
Hi
Relation between Person and Office is: 1 to {0 or 1}
There a 3 classes (sources attached):
* PersonPk
* Person
* Office
SCENARIO
--------
final Office office = em.find(Office.class, new PersonPk("adam", "woz"));
System.out.println(office.getPerson().getZodiac());
I second line the following SQL is generated:
select
person0_.first_name as first1_22_1_,
person0_.last_name as last2_22_1_,
person0_.zodiac as zodiac22_1_,
office1_.first_name as first1_23_0_,
office1_.last_name as last2_23_0_,
office1_.address as address23_0_
from
PERSON person0_
left outer join
OFFICE office1_
on person0_.first_name=office1_.first_name
and person0_.last_name=office1_.last_name
where
person0_.first_name=?
and person0_.last_name=?
But we already know all columns for OFFICE so there is need to loaded them once again. In other words this SQL can be reduced to such SQL:
select
person0_.first_name as first1_22_1_,
person0_.last_name as last2_22_1_,
person0_.zodiac as zodiac22_1_,
from
PERSON person0_
where
person0_.first_name=?
and person0_.last_name=?
Kind regards,
Adam Woźniak / Poland
--
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, 1 month
[Hibernate-JIRA] Updated: (HHH-1851) relax special handling of 'id' property
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851?page=c... ]
Steve Ebersole updated HHH-1851:
--------------------------------
Fix Version/s: (was: 3.5.0-CR-2)
3.5.x
> relax special handling of 'id' property
> ---------------------------------------
>
> Key: HHH-1851
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851
> Project: Hibernate Core
> Issue Type: Improvement
> Components: query-hql
> Environment: independent, all versions all databases.
> Reporter: Gunther Schadow
> Assignee: Steve Ebersole
> Fix For: 3.5.x
>
> Attachments: IdClassAndAnotherPropertyNamedId.zip
>
>
> Hibernate has long treated 'id' in a special manner in HQL and Criteria queries. The drawback to this has always been that it effectively means users cannot define non-identifier properties named id and refer to those properties in HQL/Criteria queries.
> Thus, I will change this such that:
> (1) 'id' can still be used to refer to the identifier property, whatever the property's actual name, as long as the entity does not define a non-identitifer property named id.
> (2) if the entity defines a non-identifier property named 'id', using 'id' in HQL or Criteria queries will refer to this non-identifier property; users would need to refer to the identifier property by its actual name.
> FYI, the original reason for this feature was to support entity's which did not define an identifier property at all (users were responsible for managing the ids seperately. That feature was never really recommended and has been deprecated since early in the 3.x development.
--
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, 1 month
[Hibernate-JIRA] Created: (HHH-4923) EnitityManager returning lazy proxy
by Billy Bob (JIRA)
EnitityManager returning lazy proxy
-----------------------------------
Key: HHH-4923
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4923
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: JBoss - MySQL 5.1 - JDK6
Reporter: Billy Bob
Depending on the order I read entities, sometimes an em.find() returns a javassist proxy. I have the following simplified entity mapping:
class A {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
}
class B extends A {
}
class C extends A {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(nullable=false)
private A ref;
}
For both scenarios, I have an entity of type B stored with id 20 and an entity of type C stored with id 30 with a reference to the first object with id 20.
Scenario - 1:
em.find(A.class, 30); // Returns type C, lazy reference of B is loaded into session
em.find(A.class, 20); // Error: Returns javassist proxy instead of type B
Scenario - 2:
em.find(A.class, 20); // Returns type B, since not loaded by C lazy reference
em.find(A.class, 30); // Returns type C
Should a call to EntityManager.find() ever return a lazy proxy?
--
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, 1 month
[Hibernate-JIRA] Created: (HV-286) NoSuchMethodError on Persistence.getPersistenceUtil() when one follows the README file
by Mathias De Belder (JIRA)
NoSuchMethodError on Persistence.getPersistenceUtil() when one follows the README file
--------------------------------------------------------------------------------------
Key: HV-286
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-286
Project: Hibernate Validator
Issue Type: Patch
Components: documentation
Affects Versions: 4.0.2.GA
Environment: Hibernate Validator 4.0.2 GA
Hibernate Core 3.5.0-Beta 2 (+ Annotations, no EntityManager)
WebLogic 10MP1 (EE5/JPA1)
JDK5
Reporter: Mathias De Belder
Assignee: Hardy Ferentschik
Priority: Trivial
Attachments: readme.patch
The readme.txt file tells one to add all the libraries from
the lib/ subdirectory of the distribution package on the classpath:
"- Copy hibernate-validator-*.jar together will all jar files from lib into the
classpath of your application. In case you are running on JDK5 you have to also include
all the jar files from the jdk5 subdirectory."
The lib/ directory in 4.0.2GA contains jpa-api-2.0.Beta-20090815.jar, the public JPA2
API. Included in that jar file is javax/persistence/PersistenceUtil.class.
org.hibernate.validator.engine.resolver.DefaultTraversableResolver is the default
TraversableResolver one gets when one calls Validation.buildDefaultValidationFactory().
In its constructor, DefaultTraversableResolver calls detectJPA(), which looks for
the PersistenceUtil class on the classpath. When this is found (in jpa-api-2.0.jar),
the two methods in the TraversableResolver interface are delegated to JPATraversableResolver,
which triggers an exception because it calls Persistence.getPersistenceUtil(), which is not
implemented by JPA1 providers (in this case, WebLogic 10).
See also http://java.sun.com/javaee/6/docs/api/javax/persistence/Persistence.html#....
The workaround is easy: don't have a javax.persistence.PersistenceUtil class file on
your classpath when you do not have a JPA2 provider on there too.
The attached patch adds a note in the README telling users not to add the jpa2-api
jar if they do not intend to use Hibernate Validation 4 with an JPA2 EntityManager
but instead with Hibernate Core or JPA1, or maybe even without an ORM framework.
--
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, 1 month