[Hibernate-JIRA] Commented: (HHH-1852) @MappedSuperclass - PropertyAccessException
by Olaf Lenzmann (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1852?page=c... ]
Olaf Lenzmann commented on HHH-1852:
------------------------------------
Still a problem as of 3.2.3.ga
> @MappedSuperclass - PropertyAccessException
> -------------------------------------------
>
> Key: HHH-1852
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1852
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.0.cr2
> Environment: hibernate-3.2.0.cr2, hibernate-annotations-3.2.0.cr1, hibernate-entitymanager-3.2.0.cr1
> Reporter: David de Mingo
> Attachments: src.zip
>
>
> Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.endea.model.product.ProductAttribute.data
> at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
> at org.hibernate.property.DirectPropertyAccessor$DirectGetter.getForInsert(DirectPropertyAccessor.java:40)
> at org.hibernate.tuple.AbstractEntityTuplizer.getPropertyValuesToInsert(AbstractEntityTuplizer.java:264)
> ...
> Caused by: java.lang.IllegalArgumentException
> at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
> at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
> at java.lang.reflect.Field.get(Field.java:357)
> at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32)
> ... 41 morer
--
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
17 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1743) Wrong order of binding parameters in Restrictions.in for composite primary keys
by Jay (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1743?page=c... ]
Jay commented on HHH-1743:
--------------------------
Hi. I've noticed the same problem with inner components.
*** The HBM ***
<class name="EntreeJournal" table="journal_alimentation" ... >
...
<component name="plageCollecte" class="fr.recouv.contact.core.bo.calendrier.PlageJournaliere" ... >
<property name="date" column="date_collecte" type="date" />
<component name="plageHoraire" class="fr.recouv.contact.core.bo.calendrier.PlageHoraire" ... >
<property name="heureDebut" column="heure_debut" type="time" />
<property name="heureFin" column="heure_fin" type="time" />
</component>
</component>
*** The BOs ***
The pojo PlageJournaliere has a date property and a plageHoraire property, that in turn has two date fields: heureDebut and heureFin.
public class PlageJournaliere {
...
private Date date;
private PlageHoraire plageHoraire;
...
}
public class PlageHoraire {
...
private Date heureDebut;
private Date heureFin;
...
}
*** The DAO ***
Collection<PlageJournaliere> plages = ...;
Criteria criteria = session.createCriteria(EntreeJournal.class).
add( Restrictions.in("plageCollecte", plages) );
*** THE QUERY ***
[...]
where
(
this_.date_collecte, this_.heure_debut, this_.heure_fin
) in (
(
?, ?, ?
), (
?, ?, ?
), (
?, ?, ?
)
)
Query is good but binding is done in he wrong order.
$1 = date collecte 1
$2 = date collecte 2
$3 = date collecte 3
$4 = heure debut 1
$5 = heure fin 1
$6 = heure debut 2
$7 = heure fin 2
$8 = heure debut 3
$9 = heure fin 3
As a workaround, I build the where statement dynamicaly in doInHibernate() with Restrictions.and(), Restrictions.or() and others.
Best regards.
> Wrong order of binding parameters in Restrictions.in for composite primary keys
> -------------------------------------------------------------------------------
>
> Key: HHH-1743
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1743
> Project: Hibernate3
> Issue Type: Bug
> Components: query-criteria
> Affects Versions: 3.2.0 cr1
> Environment: Windows XP, Oracle 10g
> Reporter: Viatcheslav Sysoltsev (Slavka)
> Attachments: HibernateTest_restrictions_in_parameter_binding.zip
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> There is a table Person with composite primary key:
> PERSON
> primary key fields:
> FAMILY
> NUMBER
> For the Criteria Query like
> List<PersonId> ids = new Vector<PersonId>();
> ids.add(new PersonId("SLAVA1", 10L));
> ids.add(new PersonId("SLAVA2", 20L));
> ids.add(new PersonId("SLAVA3", 30L));
> List<Person> persons = session.createCriteria(Person.class)
> .add(Restrictions.in("id", ids))
> .list();
> the query is generated
> select this_.FAMILY as FAMILY0_0_, this_.NUMBER as NUMBER0_0_ from PERSON this_ where (this_.FAMILY, this_.NUMBER) in ((?, ?), (?, ?), (?, ?))
> The query is right, but the parameters are bound in wrong order, here is the excerpt from the log:
> 16:21:33,221 DEBUG [SQL] select this_.FAMILY as FAMILY0_0_, this_.NUMBER as NUMBER0_0_ from PERSON this_ where (this_.FAMILY, this_.NUMBER) in ((?, ?), (?, ?), (?, ?))
> Hibernate: select this_.FAMILY as FAMILY0_0_, this_.NUMBER as NUMBER0_0_ from PERSON this_ where (this_.FAMILY, this_.NUMBER) in ((?, ?), (?, ?), (?, ?))
> 16:21:33,221 DEBUG [AbstractBatcher] preparing statement
> 16:21:33,330 DEBUG [StringType] binding 'SLAVA1' to parameter: 1
> 16:21:33,330 DEBUG [StringType] binding 'SLAVA2' to parameter: 2
> 16:21:33,330 DEBUG [StringType] binding 'SLAVA3' to parameter: 3
> 16:21:33,330 DEBUG [LongType] binding '10' to parameter: 4
> 16:21:33,330 DEBUG [LongType] binding '20' to parameter: 5
> 16:21:33,330 DEBUG [LongType] binding '30' to parameter: 6
> I've made an example (attached, standalone eclipse project with all libs) which demonstrates the problem, but you need running oracle somewhere to run it. See also bug report HH-708 which is predecessor of this.
> The problem may lay in org.hibernate.criterion.InExpression::getTypedValues.
> Instead of
> for ( int i=0; i<types.length; i++ ) {
> for ( int j=0; j<values.length; j++ ) {
> Object subval = values[j]==null ?
> null :
> actype.getPropertyValues( values[j], EntityMode.POJO )[i];
> list.add( new TypedValue( types[i], subval, EntityMode.POJO ) );
> }
> }
> should be
> for ( int j=0; j<values.length; j++ ) {
> for ( int i=0; i<types.length; i++ ) {
> Object subval = values[j]==null ?
> null :
> actype.getPropertyValues( values[j], EntityMode.POJO )[i];
> list.add( new TypedValue( types[i], subval, EntityMode.POJO ) );
> }
> }
> After change have worked for me. But I am not sure whether the syntax of what's going from Restriction.in is database-specific.
--
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
17 years, 5 months
[Hibernate-JIRA] Created: (EJB-309) compile query differences when running a count verses a standard query. VIA EJB3 entity manager
by Grant Quimby (JIRA)
compile query differences when running a count verses a standard query. VIA EJB3 entity manager
-----------------------------------------------------------------------------------------------
Key: EJB-309
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-309
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.2.1
Environment: JBoss 4.0.5.GA - EJB3
Reporter: Grant Quimby
Difference SQL generated where clause from count to normal query.
Count Query (Works properly)
where
(exists
(select distinct facility1_.FACILITY_ID from LUCI_FACILITY facility1_
where emissionsr0_.FACILITY_ID=facility1_.FACILITY_ID
and (upper(facility1_.JURISDICTION_FACILITY_ID) like upper('%00003977%') escape '\')
and facility1_.STANDALONE_FLAG='Y'
and facility1_.ACTIVE_FLAG='Y'
and facility1_.CURRENT_FLAG='Y')
or exists
(select distinct facility3_.FACILITY_ID
from LUCI_FACILITY facility2_ inner join LUCI_FACILITY facility3_ on facility2_.CURRENT_FACILITY_ID=facility3_.FACILITY_ID
where emissionsr0_.FACILITY_ID=facility2_.FACILITY_ID
and (upper(facility3_.JURISDICTION_FACILITY_ID) like upper('%00003977%') escape '\')
and facility3_.STANDALONE_FLAG='Y'
and facility3_.ACTIVE_FLAG='Y'
and facility3_.CURRENT_FLAG='Y'))
and emissionsr0_.ACTIVE_FLAG='Y'
Normal Query (Fails)
where emissionsr0_.FACILITY_ID=facility2_.FACILITY_ID
and
(exists
(select distinct facility2_.FACILITY_ID
from LUCI_FACILITY facility2_
where (upper(facility2_.JURISDICTION_FACILITY_ID) like upper('%00003977%') escape '\')
and facility2_.STANDALONE_FLAG='Y'
and facility2_.ACTIVE_FLAG='Y'
and facility2_.CURRENT_FLAG='Y')
or exists
(select distinct facility2_.FACILITY_ID
from LUCI_FACILITY facility2_
where (upper(facility2_.JURISDICTION_FACILITY_ID) like upper('%00003977%') escape '\')
and facility2_.STANDALONE_FLAG='Y'
and facility2_.ACTIVE_FLAG='Y'
and facility2_.CURRENT_FLAG='Y'))
and emissionsr0_.ACTIVE_FLAG='Y'
--
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
17 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1920) Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3).
by Ignat Zapolsky (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920?page=c... ]
Ignat Zapolsky commented on HHH-1920:
-------------------------------------
Original documentation shows incorrect code that will change root element instead of adding child nodes to it. Thanks for resolving this issue "very quickly" and "appropriately".
> Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3).
> ------------------------------------------------------------------------------------------------
>
> Key: HHH-1920
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920
> Project: Hibernate3
> Issue Type: Bug
> Components: documentation
> Affects Versions: 3.1.3
> Reporter: Ignat Zapolsky
> Assignee: Diego Pires Plentz
> Priority: Trivial
>
> Manual has following sample (chapter 18.3):
> Session session = factory.openSession();
> Session dom4jSession = session.getSession(EntityMode.DOM4J);
> Transaction tx = session.beginTransaction();
> List results = dom4jSession
> .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName")
> .list();
> for ( int i=0; i<results.size(); i++ ) {
> //add the customer data to the XML document
> Element customer = (Element) results.get(i);
> doc.add(customer);
> }
> Mentioned code simply changes root node of doc, but supposed to add child elements.
> Correct code shall look like:
> Session session = factory.openSession();
> Session dom4jSession = session.getSession(EntityMode.DOM4J);
> Transaction tx = session.beginTransaction();
> List results = dom4jSession
> .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName")
> .list();
> for ( int i=0; i<results.size(); i++ ) {
> //add the customer data to the XML document
> Element customer = (Element) results.get(i);
> doc.getRootEelemnt().add(customer);
> }
--
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
17 years, 5 months
[Hibernate-JIRA] Resolved: (HHH-1920) Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3).
by Diego Pires Plentz (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920?page=c... ]
Diego Pires Plentz resolved HHH-1920.
-------------------------------------
Resolution: Rejected
"Mentioned code simply changes root node of doc, but supposed to add child elements."
Closing as "rejected", since documentation are explicit saying that "add the customer data to the XML document ", makes no sense to change the rootElement..
> Incorrect documentation regarding XML manipulation in Hibernate reference manual (chapter 18.3).
> ------------------------------------------------------------------------------------------------
>
> Key: HHH-1920
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1920
> Project: Hibernate3
> Issue Type: Bug
> Components: documentation
> Affects Versions: 3.1.3
> Reporter: Ignat Zapolsky
> Assignee: Diego Pires Plentz
> Priority: Trivial
>
> Manual has following sample (chapter 18.3):
> Session session = factory.openSession();
> Session dom4jSession = session.getSession(EntityMode.DOM4J);
> Transaction tx = session.beginTransaction();
> List results = dom4jSession
> .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName")
> .list();
> for ( int i=0; i<results.size(); i++ ) {
> //add the customer data to the XML document
> Element customer = (Element) results.get(i);
> doc.add(customer);
> }
> Mentioned code simply changes root node of doc, but supposed to add child elements.
> Correct code shall look like:
> Session session = factory.openSession();
> Session dom4jSession = session.getSession(EntityMode.DOM4J);
> Transaction tx = session.beginTransaction();
> List results = dom4jSession
> .createQuery("from Customer c left join fetch c.accounts where c.lastName like :lastName")
> .list();
> for ( int i=0; i<results.size(); i++ ) {
> //add the customer data to the XML document
> Element customer = (Element) results.get(i);
> doc.getRootEelemnt().add(customer);
> }
--
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
17 years, 5 months