[Hibernate-JIRA] Updated: (ANN-37) @SqlInsert(), @SqlUpdate(), @SqlDelete(), @Loader()
by László Benke (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-37?page=all ]
László Benke updated ANN-37:
----------------------------
Attachment: customsqlannotations.patch
Hello!
I've made these annotations in 3.2.0GA. I think it's work fine maybe it will be useful for others too.
I've add a style parameter to SqlInsert,SqlUpdate,SqlDelete annotations to be able to define ExecuteUpdateResultCheckStyle.
I'm sorry if I made it in wrong way, I tried my best!
Yours
Laszlo Benke
> @SqlInsert(), @SqlUpdate(), @SqlDelete(), @Loader()
> ---------------------------------------------------
>
> Key: ANN-37
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-37
> Project: Hibernate Annotations
> Type: Improvement
> Components: binder
> Versions: 3.1beta3
> Reporter: Emmanuel Bernard
> Priority: Trivial
> Attachments: customsqlannotations.patch
>
>
> @SqlInsert(statement="", callable=false),
> @SqlUpdate(statement="", callable=false),
> @SqlDelete(statement="", callable=false),
> @Loader(namedQuery="")
--
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
19 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1568) <subselect> returns stale data, <synchronize> doesn't evict <subselect> objects from session when session is flushed
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1568?page=c... ]
Max Rydahl Andersen commented on HHH-1568:
------------------------------------------
There is *no* difference on how this work with normal entities in hibernate when you have already loaded objects into the session.
this is my last comment here since this is not a bug; feel free to start a talk in the forum and put the link here.
> <subselect> returns stale data, <synchronize> doesn't evict <subselect> objects from session when session is flushed
> --------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1568
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1568
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.2
> Environment: Oracle 10g, Java 5, Windows,
> Reporter: Greg Matthews
> Attachments: SubselectTest.java, subselect_stale_data.log
>
>
> Stale data is being returned from a select against a Hibernate class based on a <subselect> element (instead of a table).
> See detailed log info attached.
> A flush is occuring againt entities referenced within <synchronize> elements in the <subclass> based class, but a subsequent HQL query executed against the <subclass> based class still returns stale data. The log details show that the <subclass> object is retrieved from session.
> Our expectation is that it makes sense for Hibernate to automatically evict objects from session when synchronization causes other entities to be flushed -- otherwise, the whole <synchronization> mechanism is useless and you might as well do everything manually via various evict calls.
> e.g.
> If I have 2 mapping files, one for Table A, and another for a <subselect> based on Table A (let's call this View_A, then I will declare a <synchonized> element in View_A so that any changes to A are flushed before records from View_A are retrieved.
> This seems to work ok in that A is flushed when a query against View_A being executed, but subsequent retrieval of View_A gets loaded from Session, and not from the DB like we'd expect.
> If we manually evict the rows from View_A before executing the HQL query against View_A then up-to-date data is retrieved from View_A.
> Another strange thing is that if we *query* View_A after editing records from A, then the following message appears....
> 12:43:24 DEBUG org.hibernate.engine.ActionQueue.areTablesToUpdated - changes must be flushed to space: A
> ...but if we *load* a record from View_A then this message above does not appear. I would have thought any attempt to access View_A after updates to A had occurred would trigger a flush to A. Hopefully the flush occurs behind the scenes in all cases, and it's just a case of a missing log message in the case of doing a session.load().
--
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
19 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1568) <subselect> returns stale data, <synchronize> doesn't evict <subselect> objects from session when session is flushed
by Greg Matthews (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1568?page=c... ]
Greg Matthews commented on HHH-1568:
------------------------------------
Hi Max,
(quote) "If you go and map two classes to the same table do you expect that changing the first will evict the second ? "
Yes actually, especially if I'm using the <synchronized> tag with the <subselect>
See http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html#mappi... at the end of the 5.1.3 section.
"Declare the tables to synchronize this entity with, ensuring that auto-flush happens correctly, and that queries against the derived entity *****do not return stale data*****. The <subselect> is available as both as an attribute and a nested mapping element." (emphasis mine).
This Jira issue is specifically related to querying against a derived entity (<subselect>) and that i'm seeing stale data returned.
Either the doco is completely wrong, you're wrong, or I still don't understand something here.
I'd really appreciate it if you could clarify. No I haven't posted on the forum yet since I am still of the view this is a bug.
Best Regards,
> <subselect> returns stale data, <synchronize> doesn't evict <subselect> objects from session when session is flushed
> --------------------------------------------------------------------------------------------------------------------
>
> Key: HHH-1568
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1568
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1.2
> Environment: Oracle 10g, Java 5, Windows,
> Reporter: Greg Matthews
> Attachments: SubselectTest.java, subselect_stale_data.log
>
>
> Stale data is being returned from a select against a Hibernate class based on a <subselect> element (instead of a table).
> See detailed log info attached.
> A flush is occuring againt entities referenced within <synchronize> elements in the <subclass> based class, but a subsequent HQL query executed against the <subclass> based class still returns stale data. The log details show that the <subclass> object is retrieved from session.
> Our expectation is that it makes sense for Hibernate to automatically evict objects from session when synchronization causes other entities to be flushed -- otherwise, the whole <synchronization> mechanism is useless and you might as well do everything manually via various evict calls.
> e.g.
> If I have 2 mapping files, one for Table A, and another for a <subselect> based on Table A (let's call this View_A, then I will declare a <synchonized> element in View_A so that any changes to A are flushed before records from View_A are retrieved.
> This seems to work ok in that A is flushed when a query against View_A being executed, but subsequent retrieval of View_A gets loaded from Session, and not from the DB like we'd expect.
> If we manually evict the rows from View_A before executing the HQL query against View_A then up-to-date data is retrieved from View_A.
> Another strange thing is that if we *query* View_A after editing records from A, then the following message appears....
> 12:43:24 DEBUG org.hibernate.engine.ActionQueue.areTablesToUpdated - changes must be flushed to space: A
> ...but if we *load* a record from View_A then this message above does not appear. I would have thought any attempt to access View_A after updates to A had occurred would trigger a flush to A. Hopefully the flush occurs behind the scenes in all cases, and it's just a case of a missing log message in the case of doing a session.load().
--
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
19 years, 6 months
[Hibernate-JIRA] Commented: (HHH-1774) Component parameters bound incorrectly
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=c... ]
Steve Ebersole commented on HHH-1774:
-------------------------------------
Note, Anthony, that as a work-around your failing test could simply reverse the parameters:
from Order o where o.customer.name =:name and o.id = :id
which works fine.
The issues comes up whenever a parameter to be bound follows the named component parameter in the HQL string...
> Component parameters bound incorrectly
> --------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Fix For: 3.2.1
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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
19 years, 6 months
[Hibernate-JIRA] Updated: (HHH-1774) Component parameters bound incorrectly
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774?page=all ]
Steve Ebersole updated HHH-1774:
--------------------------------
Summary: Component parameters bound incorrectly (was: Wrong SQL generated from a composite-id HQL.)
Fix Version: 3.2.1
Version: (was: 3.2.0.cr3)
(was: 3.2.0.cr4)
(was: 3.1.3)
(was: 3.2.0 cr1)
(was: 3.2.0.cr2)
Assign To: Steve Ebersole
The original issue was actually implemented quite early on in 3.2 development. I do not have the issue # by which I was tracking that feature request. However, Anthony's comments do show an issue in this code. Namely, binding of multi-column named parameters is currently not being handled correctly.
> Component parameters bound incorrectly
> --------------------------------------
>
> Key: HHH-1774
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1774
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Environment: Hibernate 3.1.3 / 3.2.0 cr1 / 3.2.9 cr2
> Database: PostgreSQL 8.0 and Oracle 7.3.4
> Reporter: Regis Pires Magalhaes
> Assignee: Steve Ebersole
> Fix For: 3.2.1
> Attachments: CompositeIdTest.java
>
>
> Hibernate is generating a wrong SQL related to a composite-id HQL.
> The details of the problem are described below...
> MAPPING:
> <hibernate-mapping>
> <class name="Cobrador" table="cobrador">
> <composite-id name="id" class="CobradorId">
> <key-property name="empresa"/>
> <key-property name="matricula"/>
> </composite-id>
> <property name="nome" type="string"/>
> </class>
> </hibernate-mapping>
> HQL:
> from Cobrador cobrador
> where cobrador = :cobrador
> GENERATED SQL:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=?
> PARAMETERS BINDING:
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1' to parameter: 1
> DEBUG 13/05/2006 10:32:18 [org.hibernate.type.IntegerType:80] - binding '1234' to parameter: 2
> Note that 2 parameters are binded, but there is just a single parameter in the generated SQL.
> DATABASE EXCEPTION:
> org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1
> The generated SQL should be:
> select cobrador0_.empresa as empresa3_,
> cobrador0_.matricula as matricula3_,
> cobrador0_.nome as nome3_,
> from cobrador cobrador0_
> where (cobrador0_.empresa, cobrador0_.matricula)=(?, ?)
--
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
19 years, 6 months