You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Gary Stevens (JIRA)" <ji...@apache.org> on 2009/05/11 17:59:45 UTC

[jira] Created: (SHINDIG-1057) [PATCH] Samples project

[PATCH] Samples project
-----------------------

                 Key: SHINDIG-1057
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
             Project: Shindig
          Issue Type: Improvement
          Components: Java
    Affects Versions: trunk
         Environment: Eclipse, Hibernate
            Reporter: Gary Stevens
             Fix For: trunk


This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.

Edited classes:
EnumImpl.java
AddressDb.java
BodyTypeDb.java
EnumDb.java
MediaItemDb.java
NameDb.java
PersonAddressDb.java
PersonDb.java

Added the class: HibernateEntityManagerProvider.java


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Gary Stevens (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708417#action_12708417 ] 

Gary Stevens commented on SHINDIG-1057:
---------------------------------------

The patch is the changes I had to make to Shindig in order to use a persistent database through the shindig-samples project.  It's a hack, but I thought it was worth sharing for anyone else who may be using the shindig-samples project.

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SHINDIG-1057) [PATCH] Samples project

Posted by "Gary Stevens (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Stevens updated SHINDIG-1057:
----------------------------------

    Attachment: patch.txt

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Gary Stevens (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708545#action_12708545 ] 

Gary Stevens commented on SHINDIG-1057:
---------------------------------------

I'm sorry I did not go into enough detail before.

I made these changes as I tried to use the samples project to create a database of the data stored in the canonicaldb.json file and using the database instead of the JSON file.  I created the database by running the PersonServiceDbTest after commenting out all but one test case and commenting out the call to bootstrap.tearDown().

I removed the List<Person> relationships because when my container was running and created the Java classes from the data in the database Shindig would go into a loop inside the JsonSerializer.java class.  For example, when an AddressDb object was being created and the List<Person> atLocation variable was being initialized a new PersonDb object would be created, which would be initialized until any addresses belonging to the person were loaded, which were AddressDb objects with List<Person> atLocation variables, which created a new PersonDb object, etc. until I saw a stack overflow error in the Eclipse console.

I modified the toString() methods in EnumDb.java and EnumImpl.java because addresses in memory were being stored in my database instead of String representations of the enumeration.

I added .toUpperCase() to MediaItemDb.java's populateDbFields() method because when the media type was stored as a lower case String in my database it was not recognized as a valid enumerated value for a MediaItem when the lowercase String was pulled back out of the database.  

In PersonDb.java's populateDbFields() method, I added the condition !v.equals("") to the if-statement on line 1185 to skip over fields in my database that were populated with only an empty String.  I added the line properties.add(pp); as the last line of the same if-statement because without it none of the transient columns were actually being stored as PersonPropertyDb objects in the database.

I do not know if it is just a Hibernate issue or a general JPA issue.  I had tried to use EclipseLink before trying Hibernate, but had trouble.  I would see errors in my Eclipse console because of the asterisk character used in the query built in JPQLUtils.java's getTotalResults(...) method.  After searching, my understanding is that EclipseLink does not support an asterisk in the count() call.

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by Ian Boston <ie...@tfd.co.uk>.
Gary,
I am sorry, I have been snowed under on another project, I haven't had  
time. (the 1.0 release has got to embarrassment level, so I am trying  
to find spare moments to kick of builds on that).
When I get a moment, I will have a look, there are other committers  
who have worked in this space that may have the time to review this?

Ping the list in a week if you haven't heard anything.
Ian
On 1 Jun 2009, at 23:23, Gary Stevens (JIRA) wrote:

>
>    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715284 
> #action_12715284 ]
>
> Gary Stevens commented on SHINDIG-1057:
> ---------------------------------------
>
> Ian,
> I am sure you have been busy with the Shindig 1.0 release, but I  
> wanted to ask if you have had a chance to verify the shindig-samples  
> project code behavior yet?
>
>> [PATCH] Samples project
>> -----------------------
>>
>>                Key: SHINDIG-1057
>>                URL: https://issues.apache.org/jira/browse/ 
>> SHINDIG-1057
>>            Project: Shindig
>>         Issue Type: Improvement
>>         Components: Java
>>   Affects Versions: trunk
>>        Environment: Eclipse, Hibernate
>>           Reporter: Gary Stevens
>>            Fix For: trunk
>>
>>        Attachments: patch.txt
>>
>>
>> This patch includes changes in order to run Shindig with a database  
>> using Hibernate.  Based on Shindig trunk revision 769318 from April  
>> 28, 2009.  The patch file was made inside of Eclipse.
>> Edited classes:
>> EnumImpl.java
>> AddressDb.java
>> BodyTypeDb.java
>> EnumDb.java
>> MediaItemDb.java
>> NameDb.java
>> PersonAddressDb.java
>> PersonDb.java
>> Added the class: HibernateEntityManagerProvider.java
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>


Re: [jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by Ian Boston <ie...@tfd.co.uk>.
Gary,
I am sorry, I have been snowed under on another project, I haven't had  
time. (the 1.0 release has got to embarrassment level, so I am trying  
to find spare moments to kick of builds on that).
When I get a moment, I will have a look, there are other committers  
who have worked in this space that may have the time to review this?

Ping the list in a week if you haven't heard anything.
Ian
On 1 Jun 2009, at 23:23, Gary Stevens (JIRA) wrote:

>
>    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715284 
> #action_12715284 ]
>
> Gary Stevens commented on SHINDIG-1057:
> ---------------------------------------
>
> Ian,
> I am sure you have been busy with the Shindig 1.0 release, but I  
> wanted to ask if you have had a chance to verify the shindig-samples  
> project code behavior yet?
>
>> [PATCH] Samples project
>> -----------------------
>>
>>                Key: SHINDIG-1057
>>                URL: https://issues.apache.org/jira/browse/ 
>> SHINDIG-1057
>>            Project: Shindig
>>         Issue Type: Improvement
>>         Components: Java
>>   Affects Versions: trunk
>>        Environment: Eclipse, Hibernate
>>           Reporter: Gary Stevens
>>            Fix For: trunk
>>
>>        Attachments: patch.txt
>>
>>
>> This patch includes changes in order to run Shindig with a database  
>> using Hibernate.  Based on Shindig trunk revision 769318 from April  
>> 28, 2009.  The patch file was made inside of Eclipse.
>> Edited classes:
>> EnumImpl.java
>> AddressDb.java
>> BodyTypeDb.java
>> EnumDb.java
>> MediaItemDb.java
>> NameDb.java
>> PersonAddressDb.java
>> PersonDb.java
>> Added the class: HibernateEntityManagerProvider.java
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Gary Stevens (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715284#action_12715284 ] 

Gary Stevens commented on SHINDIG-1057:
---------------------------------------

Ian,
I am sure you have been busy with the Shindig 1.0 release, but I wanted to ask if you have had a chance to verify the shindig-samples project code behavior yet?

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708242#action_12708242 ] 

Ian Boston commented on SHINDIG-1057:
-------------------------------------

Could you explain the rational behind the patch, please.




> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708874#action_12708874 ] 

Ian Boston commented on SHINDIG-1057:
-------------------------------------

Thank you for all your work, and the explanation. 
Before I apply the patch, which I am sure is a valid solution I want to verify the behavior you have reported. 
Thanks
Ian

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SHINDIG-1057) [PATCH] Samples project

Posted by "Ian Boston (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHINDIG-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708473#action_12708473 ] 

Ian Boston commented on SHINDIG-1057:
-------------------------------------

I will be a bit more specific.

Why are all the List<Person> relationships removed ?
What problem did you encounter with these ?
Is this a Hibernate only issue, or a general JPA issue ?
Should their be more unit tests to expose the problem you encountered ?

The problem with patches is, unless they get applied, they go stale, once stale they tend to be less useful. 
To get applied there needs to be a bit more information than "patch changes the code base and fixes my problem"

Thanks
Ian

> [PATCH] Samples project
> -----------------------
>
>                 Key: SHINDIG-1057
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1057
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Java
>    Affects Versions: trunk
>         Environment: Eclipse, Hibernate
>            Reporter: Gary Stevens
>             Fix For: trunk
>
>         Attachments: patch.txt
>
>
> This patch includes changes in order to run Shindig with a database using Hibernate.  Based on Shindig trunk revision 769318 from April 28, 2009.  The patch file was made inside of Eclipse.
> Edited classes:
> EnumImpl.java
> AddressDb.java
> BodyTypeDb.java
> EnumDb.java
> MediaItemDb.java
> NameDb.java
> PersonAddressDb.java
> PersonDb.java
> Added the class: HibernateEntityManagerProvider.java

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.