Re: [Hibernate] BindHelper.findPropertiesByColumns behaviour is non deterministic due to HashSet being used.

2006-03-29 Thread Ronn . Chinowutthichai


> 3. was my initial thought, why do you think it won't help for multi

> column mapping?

Probably due to my lack of understanding on how column
mapping works. I'm confused why columnsToProperty is a Map>
- can there be more than one property mapping to a join column? And if
that is the case, down below when iterate through all the columnsToProperty
mappings it has found, only first one is selected and put into orderedProperties
anyway (BindHelper:234).

But yes techically, synthetic property shouldn't need
to be considered in BinderHelper.findPropertiesByColumns method anyway.
I'm wondering that if there is ever more than one property being mapped
into a column then HashSet iterator won't guarantee the order and similar
behaviour will still occur.


Regards,
rOnn c.










Emmanuel Bernard <[EMAIL PROTECTED]>
29/03/2006 08:38 PM
        
        To:
       [EMAIL PROTECTED]
        cc:
       hibernate-devel@lists.sourceforge.net
        Subject:
       Re: [Hibernate] BindHelper.findPropertiesByColumns
behaviour is non deterministic due to HashSet being used.


You have found a bug for sure, so JIRA can be used
:-)
Thanks for having tracking down the bug, that will help a lot.
When you use an embeddedaccessor, you expect the information to be 
filled through alternative properties, hence a noop here.

3. was my initial thought, why do you think it won't help for multi 
column mapping?


[EMAIL PROTECTED] wrote:
>
> Hi Emmanuel,
>
> I think we might have found a bug in 
> BindHelper.bindPropertiesByColumns, want to run by you to see if it's

> worth while submitting to Jira.
>
> What we are trying to do is to associate two attributes of the same

> type to an object.
>
> i.e.,
>
> class Deal {
>   @ManyToOne
>   @JoinColumn(name = "a_customer_id", referencedColumnName
= 
> "customer_id", nullable = true)
>   Customer a;
>  
>  @ManyToOne
>  @JoinColumn(name = "b_customer_id", referencedColumnName
= 
> "customer_id", nullable = true)
>  Customer b;
> }
>
> // note: customer id is not a pk
> class Customer {
>   @Column(name = "customer_id")
>   String customerId;  
> }
>
> When loading deal object, customer a is always populated correctly
but 
> customer b will only be populated occasionally (depending on your
luck!).
>
> After digging through Hibernate annotation source, I think I've found

> the cause of the problem in BindHelper.bindPropertiesByColumns where

> HashSet is being used.
>
> From looking through the source, my understanding is that hibernate

> will create a synthetic property for each of the customer Deal.a and

> Deal.b and add it to a list of properties type mapping within Customer

> persistent class object. This type mapping is then used to hydrate

> Deal.a and Deal.b when Deal object is being resolved.
>
> When synthetic property for Deal.a is being created, the 
> propertymapping is straight forward because only customerId property

> is available in the Customer persistent class. Deal.a is then mapped

> simply to a simple type of Customer.customerId.
>
> Subsequently, when synthetic property for Deal.b is being created

> (BindHelper:97), the property mapping has two possible values - one
is 
> the Customer.customerId, the other is the recently created synthetic

> mapping (_Deal_a). These two values are extracted out and put into
a 
> HashSet (BindHelper.bindPropertiesByColumn:190). The hashset is then

> the being iterated through to return the first value of iterator 
> (which the order is not guaranteed). Obviously it would be wrong to

> create a synthetic property for Deal.b with synthetic property _Deal_a

> type mapping (which is what occasionally happens).
>
> Upon load, hibernate core will then attempt to hydrate Deal.a by 
> instantiating Customer (_Deal_a) type object and inject a_customer_id

> into an instance of _Deal_a type. This will result in a correct load.
>
> When hibernate core attempt to hydrate Deal.b, it will instantiate

> Customer (_Deal_b) type object. However, _Deal_b type object mapps
to 
> an embedded _Deal_a type. So it will then recurse through the embedded

> type, instantiate Customer (_Deal_a) type object, assign b_customer_id

> into embedded Customer.customerId after which instance of 
> Customer(_Deal_a) will be assigned to Customer.customerId (_Deal_b).

> This assignment is done via 
> EmbeddedPropertyAccessor.EmbeddedSetter.set method - which looks like

> a null implementation. The result is that Deal.b won't be set and
no 
> errors is being reported at all. What worst is that the system can

> appear to have been working most of the time, but if you add 
> additional attribute to class Deal to disturb the balance of the 
> hashcode generation, then all of the sudden it won't work.
>
> I can think of a couple of fixes in BindHelper.bindPropertiesByColumns:
> 1. Instead of using HashSet we use an ordered set to guarantee the

> order, this way the native properties will always be returned first.
> 2. Use List instead of Set to guarant

Re: [Hibernate] ejb3configuration support in ant tools

2006-03-29 Thread Max Rydahl Andersen
On Wed, 29 Mar 2006 19:11:07 +0200, Jonathan O'Connor  
<[EMAIL PROTECTED]> wrote:



Max,
I saw you exposed the AnnotationConfiguration object in the latest
Ejb3Configuration. That only goes some of the way to help the tools.


It was exposed by Emmanuel and that is exactly what I have used ;)


I
guess your last comment indicates you will refactor the Ejb3Configuration
so that you don't have to create an EntityManagerFactory to populate the
object. A method like:
  Ejb3Conguration.configurePersistentUnit(String persistentUnitName)
would be great.


I opened an issue for that which I hope emmanuel will look into since
currently the SF is actually created and thrown away which is a waste of  
cycles
at the moment. It also prevents using ejb3configuration capabilities for  
autodetection
of hbm.xml etc. to use for codegeneration so that will have to wait until  
the

Ejb3Configuration supports it.


Also, there's a bug in PersistenceXmlLoader.java (line 102)
  for ( Map.Entry entry : (Set) overrides.keySet() ) {


I found, reported and fixed that earlier today. also in jira.

/max


The call to keySet() should be to entrySet(). There's an issue raised in
the User Forum with an excellent description given:
http://forum.hibernate.org/viewtopic.php?t=957348

Ciao,
Jonathan O'Connor
XCOM Dublin


"Max Rydahl
 Andersen"
 <[EMAIL PROTECTED]   
To

 ss.com>   "Hibernate development"
 Sent by:   
<[EMAIL PROTECTED]

 hibernate-devel-a net>
 [EMAIL PROTECTED]   
cc

 forge.net
   Subject
   [Hibernate] ejb3configuration
 28/03/2006 17:02  support in ant tools





A FAQ has now been implemented.
http://opensource.atlassian.com/projects/hibernate/browse/HBX-632

meaning ejb3 autodiscovery is now possible to use with the ant tools.
(will probably only add it to the eclipse ui once I can get a bit more
control over when the sessionfactory is actually created)

--
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting  
language

that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding  
territory!

http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist  
allein

für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist
das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir  
bitten,

eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns
eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use
of the intended recipient. Any review, distribution by others or  
forwarding

without express permission is strictly prohibited. If you are not the
intended recipient, please contact the sender and delete all copies.

Hauptsitz: Bahnstrasse 33, D-47877 Willich, USt-IdNr.: DE 812 885 664
Kommunikation: Telefon +49 2154 9209-70, Telefax +49 2154 9209-900,
www.xcom.de
Handelsregister: Amtsgericht Krefeld, HRB 10340
Vorstand: Matthias Albrecht, Renate Becker-Grope, Marco Marty
Vorsitzender des Aufsichtsrates: Stephan Steuer




--
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] ejb3configuration support in ant tools

2006-03-29 Thread Jonathan O'Connor

Max,
I saw you exposed the AnnotationConfiguration object in the latest Ejb3Configuration. That only goes some of the way to help the tools. I guess your last comment indicates you will refactor the Ejb3Configuration so that you don't have to create an EntityManagerFactory to populate the object. A method like:
	Ejb3Conguration.configurePersistentUnit(String persistentUnitName)
would be great.

Also, there's a bug in PersistenceXmlLoader.java (line 102) 
	for ( Map.Entry entry : (Set) overrides.keySet() ) {

The call to keySet() should be to entrySet(). There's an issue raised in the User Forum with an excellent description given:
http://forum.hibernate.org/viewtopic.php?t=957348

Ciao,
Jonathan O'Connor
XCOM Dublin
">"Max Rydahl Andersen" <[EMAIL PROTECTED]>








"Max Rydahl Andersen" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
28/03/2006 17:02






To
"Hibernate development" 


cc



Subject
[Hibernate] ejb3configuration support in ant tools









A FAQ has now been implemented.
http://opensource.atlassian.com/projects/hibernate/browse/HBX-632

meaning ejb3 autodiscovery is now possible to use with the ant tools.
(will probably only add it to the eclipse ui once I can get a bit more
control over when the sessionfactory is actually created)

-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel




*** XCOM AG Legal Disclaimer ***

Diese E-Mail einschliesslich ihrer Anhaenge ist vertraulich und ist allein für den Gebrauch durch den vorgesehenen Empfaenger bestimmt. Dritten ist das Lesen, Verteilen oder Weiterleiten dieser E-Mail untersagt. Wir bitten, eine fehlgeleitete E-Mail unverzueglich vollstaendig zu loeschen und uns eine Nachricht zukommen zu lassen.

This email may contain material that is confidential and for the sole use of the intended recipient. Any review, distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Hauptsitz: Bahnstrasse 33, D-47877 Willich, USt-IdNr.: DE 812 885 664
Kommunikation: Telefon +49 2154 9209-70, Telefax +49 2154 9209-900, www.xcom.de
Handelsregister: Amtsgericht Krefeld, HRB 10340
Vorstand: Matthias Albrecht, Renate Becker-Grope, Marco Marty
Vorsitzender des Aufsichtsrates: Stephan Steuer



[Hibernate] ejb3configuration support in ant tools

2006-03-29 Thread Max Rydahl Andersen


A FAQ has now been implemented.
http://opensource.atlassian.com/projects/hibernate/browse/HBX-632

meaning ejb3 autodiscovery is now possible to use with the ant tools.
(will probably only add it to the eclipse ui once I can get a bit more
control over when the sessionfactory is actually created)

--
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
[EMAIL PROTECTED]
http://hibernate.org

JBoss Inc
[EMAIL PROTECTED]


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


[Hibernate] hibernate-sqlserver-jtds-testsuite Build Timed Out

2006-03-29 Thread qa

View results here -> http://cruisecontrol.jboss.com/cc/buildresults/hibernate-sqlserver-jtds-testsuite?log=log20060329021559
BUILD TIMED OUTAnt Error Message: build timeoutDate of build: 03/29/2006 02:15:59Time to build: 




    Unit Tests: (0)    Total Errors and Failures: (0) 
 Modifications since last build: (first 50 of 0)



Re: [Hibernate] BindHelper.findPropertiesByColumns behaviour is non deterministic due to HashSet being used.

2006-03-29 Thread Emmanuel Bernard

You have found a bug for sure, so JIRA can be used :-)
Thanks for having tracking down the bug, that will help a lot.
When you use an embeddedaccessor, you expect the information to be 
filled through alternative properties, hence a noop here.


3. was my initial thought, why do you think it won't help for multi 
column mapping?



[EMAIL PROTECTED] wrote:


Hi Emmanuel,

I think we might have found a bug in 
BindHelper.bindPropertiesByColumns, want to run by you to see if it's 
worth while submitting to Jira.


What we are trying to do is to associate two attributes of the same 
type to an object.


i.e.,

class Deal {
  @ManyToOne
  @JoinColumn(name = "a_customer_id", referencedColumnName = 
"customer_id", nullable = true)

  Customer a;
 
 @ManyToOne
 @JoinColumn(name = "b_customer_id", referencedColumnName = 
"customer_id", nullable = true)

 Customer b;
}

// note: customer id is not a pk
class Customer {
  @Column(name = "customer_id")
  String customerId;  
}


When loading deal object, customer a is always populated correctly but 
customer b will only be populated occasionally (depending on your luck!).


After digging through Hibernate annotation source, I think I've found 
the cause of the problem in BindHelper.bindPropertiesByColumns where 
HashSet is being used.


From looking through the source, my understanding is that hibernate 
will create a synthetic property for each of the customer Deal.a and 
Deal.b and add it to a list of properties type mapping within Customer 
persistent class object. This type mapping is then used to hydrate 
Deal.a and Deal.b when Deal object is being resolved.


When synthetic property for Deal.a is being created, the 
propertymapping is straight forward because only customerId property 
is available in the Customer persistent class. Deal.a is then mapped 
simply to a simple type of Customer.customerId.


Subsequently, when synthetic property for Deal.b is being created 
(BindHelper:97), the property mapping has two possible values - one is 
the Customer.customerId, the other is the recently created synthetic 
mapping (_Deal_a). These two values are extracted out and put into a 
HashSet (BindHelper.bindPropertiesByColumn:190). The hashset is then 
the being iterated through to return the first value of iterator 
(which the order is not guaranteed). Obviously it would be wrong to 
create a synthetic property for Deal.b with synthetic property _Deal_a 
type mapping (which is what occasionally happens).


Upon load, hibernate core will then attempt to hydrate Deal.a by 
instantiating Customer (_Deal_a) type object and inject a_customer_id 
into an instance of _Deal_a type. This will result in a correct load.


When hibernate core attempt to hydrate Deal.b, it will instantiate 
Customer (_Deal_b) type object. However, _Deal_b type object mapps to 
an embedded _Deal_a type. So it will then recurse through the embedded 
type, instantiate Customer (_Deal_a) type object, assign b_customer_id 
into embedded Customer.customerId after which instance of 
Customer(_Deal_a) will be assigned to Customer.customerId (_Deal_b). 
This assignment is done via 
EmbeddedPropertyAccessor.EmbeddedSetter.set method - which looks like 
a null implementation. The result is that Deal.b won't be set and no 
errors is being reported at all. What worst is that the system can 
appear to have been working most of the time, but if you add 
additional attribute to class Deal to disturb the balance of the 
hashcode generation, then all of the sudden it won't work.


I can think of a couple of fixes in BindHelper.bindPropertiesByColumns:
1. Instead of using HashSet we use an ordered set to guarantee the 
order, this way the native properties will always be returned first.
2. Use List instead of Set to guarantee the order - the values being 
added in to the columnsToProperty map can never be null or repeated 
anyway.
3. Filter out all of the synthetic properties from columnsToProperty 
mapping (this propbably wouldn't help for muti column mapping?).


BTW: It also perplex me why 
EmbeddedPropertyAccessor.EmbeddedSetter.set method would do nothing 
and report no error when it can't set the property.


Sorry for the lengthy email but it's a fairly subtle bug that can't 
always be replicated so I thought it's worth while explaining in 
details. Let me know if you want me to submit this to Jira. We have 
opted for option 2 on local fix and it appear to be working well.


Regards,
rOnn c.

##
DISCLAIMER:
This email and any attachment may contain confidential information.
If you are not the intended recipient you are not authorized to copy
or disclose all or any part of it without the prior written consent
of Toyota.

Opinions expressed in this email and any attachments are those of the
sender and not necessarily the opinions of Toyota.
Please scan this email and any attachment(s) for viruses.
Toyota does not accept any responsibility for problems caus

[Hibernate] Fwd: Re: error at hibernate jira installation

2006-03-29 Thread Max Rydahl Andersen


FYI if you see weird "connection is closed" messages while working with  
jira.


/max

--- Forwarded message ---
From: "Craig McElroy" <[EMAIL PROTECTED]>
To: "Max Rydahl Andersen" <[EMAIL PROTECTED]>
Cc:
Subject: Re: error at hibernate jira installation
Date: Wed, 29 Mar 2006 11:26:27 +0200

Max:
   This is an issue which we have seen pop up from time to time on
JIRA 3.4, and has been confirmed by Atlassian to be caused by http://
jira.atlassian.com/browse/JRA-9343  Now that we have recently
completed the move of this JIRA instance to its new home on a much
beefier box, we will be scheduling an upgrade of the JIRA instance as
well in the near future.  We will keep you posted regarding that
schedule.

Cheers,
-craig

---
Craig A. McElroy
Contegix LLC
[EMAIL PROTECTED]
"Beyond Managed Hosting For Your Enterprise"

On Mar 28, 2006, at 3:19 AM, Max Rydahl Andersen wrote:



Tried to create an issue an got the following:

An error occurred whilst rendering this message. Please contact the  
administrators, and inform them of this bug. Details: ---  
com.opensymphony.module.propertyset.PropertyImplementationException: SQL  
Exception while executing the following:SELECT ID, ENTITY_NAME,  
ENTITY_ID, PROPERTY_KEY, propertytype FROM propertyentry WHERE  
ENTITY_NAME=? AND ENTITY_ID=? (can't create statement from closed  
connection.) at  
com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.getKeys 
(Ljava/lang/String;I)Ljava/util/Collection;(OFBizPropertySet.java:100)  
at com.opensymphony.module.propertyset.AbstractPropertySet.getKeys() 
Ljava/util/Collection;(AbstractPropertySet.java:292) at  
com.atlassian.jira.propertyset.JiraCachingPropertySet.getKeys() 
Ljava/util/Collection;(JiraCachingPropertySet.java:225) at  
com.opensymphony.module.propertyset.PropertySetCloner.cloneProperties( 
)V(PropertySetCloner.java:114) at  
com.opensymphony.module.propertyset.PropertySetManager.clone(Lcom/ 
opensymphony/module/propertyset/PropertySet;Lcom/opensymphony/ 
module/propertyset/PropertySet;)V(PropertySetManager.java:61) at  
com.atlassian.jira.propertyset.JiraCachingPropertySet.init(Ljava/ 
util/Map;Ljava/util/Map;)V(JiraCachingPropertySet.java:411) at  
com.opensymphony.module.propertyset.PropertySetManager.getInstance 
(Ljava/lang/String;Ljava/util/Map;Ljava/lang/ClassLoader;)Lcom/ 
opensymphony/module/propertyset/PropertySet;(PropertySetManager.java:45)  
at com.opensymphony.module.propertyset.PropertySetManager.getInstance 
(Ljava/lang/String;Ljava/util/Map;)Lcom/opensymphony/module/ 
propertyset/PropertySet;(PropertySetManager.java:22) at  
com.atlassian.core.user.preferences.UserPreferences.(Lcom/ 
opensymphony/user/User;Z)V(UserPreferences.java:81) at  
com.atlassian.jira.user.preferences.JiraUserPreferences.(Lcom/ 
opensymphony/user/User;Z)V(JiraUserPreferences.java:34) at  
com.atlassian.jira.user.preferences.JiraUserPreferences.(Lcom/ 
opensymphony/user/User;)V(JiraUserPreferences.java:29) at  
com.atlassian.jira.web.action.JiraWebActionSupport.getUserPreferences( 
)Lcom/atlassian/core/user/preferences/Preferences; 
(JiraWebActionSupport.java:92) at  
com.atlassian.jira.web.action.JiraWebActionSupport.getLocale()Ljava/ 
util/Locale;(Optimized Method) at  
webwork.action.ActionSupport.getTexts(Ljava/lang/String;)Ljava/util/ 
ResourceBundle;(Optimized Method) at  
webwork.action.ActionSupport.getText(Ljava/lang/String;)Ljava/lang/ 
String;(Optimized Method) at  
com.atlassian.jira.action.JiraActionSupport.getUnescapedText(Ljava/ 
lang/String;)Ljava/lang/String;(Optimized Method) at  
com.atlassian.jira.action.JiraActionSupport.getText(Ljava/lang/ 
String;)Ljava/lang/String;(Optimized Method) at  
com.atlassian.jira.web.action.JiraWebActionSupport.getText(Ljava/ 
lang/String;Ljava/lang/Object;)Ljava/lang/String;(Optimized Method) at  
com.atlassian.jira.web.action.JiraWebActionSupport.getText(Ljava/ 
lang/String;)Ljava/lang/String;(JiraWebActionSupport.java:474) at  
jrockit.reflect.NativeMethodInvoker.invoke0(Ljava/lang/ 
Object;ILjava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown  
Source) at jrockit.reflect.NativeMethodInvoker.invoke 
(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Optimized  
Method) at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava/ 
lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Optimized Method) at  
java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/ 
lang/Object;I)Ljava/lang/Object;(Optimized Method) at  
org.apache.velocity.util.introspection.UberspectImpl 
$VelMethodImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/ 
lang/Object;(Optimized Method) at  
org.apache.velocity.runtime.parser.node.ASTMethod.execute(Ljava/ 
lang/Object;Lorg/apache/velocity/context/InternalContextAdapter;) 
Ljava/lang/Object;(Optimized Method) at  
org.apache.velocity.runtime.parser.node.ASTReference.execute(Ljava/ 
lang/Object;Lorg/apache/velocity/context/InternalContextAdapter;) 
Ljava/lang/Object;(Optimized Method) at  
org.apache.veloc