Re: [hibernate-dev] fixing 2 hibernate bugs

2012-09-24 Thread Strong Liu
I'm on vacation this week, forwarding it to hibernate-dev mail list

On Sep 24, 2012, at 3:55 PM, mutaz kabbashi  wrote:

> hi Strong
> 
> i am new here and i want to contribute to hibernate project so i start
> with simple bugs, so that i can understand the structure and coding
> conventions of hibernate
> i start with these 2 bugs
> 
> 1- DB2 HQL insert statement (https://hibernate.onjira.com/browse/HHH-7558)
> 
>   the problem here is that during the Session Factory initialization
> the sqlFunctions register Long data type as (big_integer ),while
> DB2Dialect class register it as
>(bigint) so when hibernate trying to find the data type of
> (bigint) in SqlFunctions (big_integer) hibernate throw null Pinter
> Exception ,
>I change bigint to big_integer in DB2Dialect class and it works  now
> 
> 2- getForUpdateString() of HSQLDialect returns empty string
> (https://hibernate.onjira.com/browse/HHH-7479)
> 
>   The problem here is that HQL Data base didn't support (select for
> update) statement in hql version 1.8 but it support it now  (from
> version 2.0)
>  so i modify  getForUpdate()@HSQLDialect  class and it works now
> 
> how can i commit my modifications (i already create my fork at git hub)
> 
> thank you

-
Best Regards,

Strong Liu 
http://about.me/stliu/bio

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] fixing 2 hibernate bugs

2012-09-24 Thread Brett Meyer
Mutaz, good morning!  Thanks for being willing to contribute!

https://help.github.com/articles/using-pull-requests

That article will help you.  Commit and push your changes to your fork.  Then, 
create a pull request to the original ORM project.  We'll take it from there.  
Thanks again!

- Original Message -
From: "Strong Liu" 
To: "mutaz kabbashi" 
Cc: "Hibernate hibernate-dev" 
Sent: Monday, September 24, 2012 3:58:47 AM
Subject: Re: [hibernate-dev] fixing 2 hibernate bugs

I'm on vacation this week, forwarding it to hibernate-dev mail list

On Sep 24, 2012, at 3:55 PM, mutaz kabbashi  wrote:

> hi Strong
> 
> i am new here and i want to contribute to hibernate project so i start
> with simple bugs, so that i can understand the structure and coding
> conventions of hibernate
> i start with these 2 bugs
> 
> 1- DB2 HQL insert statement (https://hibernate.onjira.com/browse/HHH-7558)
> 
>   the problem here is that during the Session Factory initialization
> the sqlFunctions register Long data type as (big_integer ),while
> DB2Dialect class register it as
>(bigint) so when hibernate trying to find the data type of
> (bigint) in SqlFunctions (big_integer) hibernate throw null Pinter
> Exception ,
>I change bigint to big_integer in DB2Dialect class and it works  now
> 
> 2- getForUpdateString() of HSQLDialect returns empty string
> (https://hibernate.onjira.com/browse/HHH-7479)
> 
>   The problem here is that HQL Data base didn't support (select for
> update) statement in hql version 1.8 but it support it now  (from
> version 2.0)
>  so i modify  getForUpdate()@HSQLDialect  class and it works now
> 
> how can i commit my modifications (i already create my fork at git hub)
> 
> thank you

-
Best Regards,

Strong Liu 
http://about.me/stliu/bio

___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] OGM-229 Beef up MongoDB documentation

2012-09-24 Thread Emmanuel Bernard
Many thanks Guillaume, I am reviewing them and rephrasing here and
there. It looks good so far. I'll probably integrate it in a few hours
and we can improve from this base.

Emmanuel

On Sun 2012-09-23 21:46, Guillaume SCHEIBEL wrote:
> Hi guys,
> 
> I've just updated the documentation with the association storage strategies
> and I also included comments from Emmanuel.
> Everything is available here:
> https://github.com/hibernate/hibernate-ogm/pull/138
> 
> Thanks for the review
> 
> Guillaume
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


Re: [hibernate-dev] OGM-229 Beef up MongoDB documentation

2012-09-24 Thread Guillaume SCHEIBEL
My pleasure :)
Actually it helps to have a good understanding of what is done. It obliged
me to ask the good question and so for to write / find out the answers.

Guillaume

2012/9/24 Emmanuel Bernard 

> Many thanks Guillaume, I am reviewing them and rephrasing here and
> there. It looks good so far. I'll probably integrate it in a few hours
> and we can improve from this base.
>
> Emmanuel
>
> On Sun 2012-09-23 21:46, Guillaume SCHEIBEL wrote:
> > Hi guys,
> >
> > I've just updated the documentation with the association storage
> strategies
> > and I also included comments from Emmanuel.
> > Everything is available here:
> > https://github.com/hibernate/hibernate-ogm/pull/138
> >
> > Thanks for the review
> >
> > Guillaume
> ___
> hibernate-dev mailing list
> hibernate-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] [OGM] @JoinColumns, @EmbeddedId & IN_ENTITY mode

2012-09-24 Thread Guillaume SCHEIBEL
Hi guys,

I'm working on OGM-236 which consists to use by default the IN_ENTITY mode
for association storage strategy instead of COLLECTION.
I've just found out a little issue, when we use @JoinColumns over a
@OneToMany property to map an @EmbeddedID with the IN_ENTITY mode, the
navigation information are not stored directly into the document itself but
another document composed by the join columns as the _id and the navigation
information (in that case the IDs that the entity is related to).

Concretely, let's starting from this mapping:
https://github.com/hibernate/hibernate-ogm/blob/master/hibernate-ogm-core/src/test/java/org/hibernate/ogm/test/id/Label.java
https://github.com/hibernate/hibernate-ogm/blob/master/hibernate-ogm-core/src/test/java/org/hibernate/ogm/test/id/News.java
https://github.com/hibernate/hibernate-ogm/blob/master/hibernate-ogm-core/src/test/java/org/hibernate/ogm/test/id/NewsID.java

and run this test with the IN_ENTITY mode on (to make the switch, a
modification into MongoDBDatastoreProvider.configure() is needed)
https://github.com/hibernate/hibernate-ogm/blob/master/hibernate-ogm-core/src/test/java/org/hibernate/ogm/test/id/CompositeIdTest.java


We can expect to have something like:

{
"_id": {
"author": "Guillaume",
"title": "There are more than 20 JUGs in France"
},
   "content": "Great! Congratulations folks",
"labels": [

{ "id": NumberLong(5) }

]

}

It means this News is related to 1 Label of which ID is 5.
But due to @JoinColumns we got this (both documents are from the News
collection):

{
"_id": {
"author": "Guillaume",
"title": "There are more than 20 JUGs in France"
},
"content": "Great! Congratulations folks",
"labels": []
} {
"_id": {
"news_author_fk": "Guillaume",
"news_topic_fk": "There are more than 20 JUGs in France"
},
"labels": [{
"id": NumberLong(5)
}]
}

Of course at the loading, when the News seems not related to any Label
because the "labels" field is empty.
A workaround it to change the @JoinColumns from:

@JoinColumns({@JoinColumn(name="news_topic_fk", referencedColumnName =
"newsid.title", nullable = false) ,
  @JoinColumn(name="news_author_fk", referencedColumnName =
"newsid.author", nullable = false)})
private List labels;

@JoinColumns({@JoinColumn(name="title", referencedColumnName =
"newsid.title", nullable = false) ,
  @JoinColumn(name="author", referencedColumnName =
"newsid.author", nullable = false)})
private List labels;

Note that the new value of each @JoinColumn's name is the same as
referenced property from the @Embedded entity.

I see there are 2 fix possible for this issue:
- we can say in case of IN_ENTITY mode don't use @JoinColumns' name to
store the navigation property but the property from the referenced
column.
- at the loading, we can check also the documents created due to @JoinColumns

Personally, I would tend to the first approach which is more natural
in terms of storage and more readable.

What do you think ?
Let me know if you need more information.

Guillaume
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev