[ 
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.

Reply via email to