Chico,
Thank you for your help. That did the trick - I was able to get my Shindig
to run with Hibernate instead of Eclipselink, and that solved the problems
and errors I had been running into before.
The next problem I have hit happens when I load the sample container. I
have Shindig pointing at my database and using Hibernate, and my Jetty
server starts running with no problems. However, when I open the sample
container I get a StackOverflow inside the JsonSerializer class. It
bounces between the appendPojo, append, and appendCollection methods until
it fills up the stack. One of the objects it appends while looping is XA,
one of the enumerated values for network presence. However, all the people
in my database have the value ONLINE for their network presence. I found
this declaration in the PersonDb class:
@Transient
protected Enum<NetworkPresence> networkPresence = new
EnumDb<NetworkPresence>(
NetworkPresence.XA);
Is this variable not being overwritten with the data from my database?
Does Shindig look into a Transient column instead of the NETWORK_PRESENCE
column of my table, and can I fix it? The other three objects my Shindig
appends in a loop seem to be memory addresses instead of strings:
org.apache.shindig.social.opensocial.jpa.perso...@d5b111,
org.apache.shindig.social.opensocial.jpa.persond...@d5d980, and.
org.apache.shindig.social.opensocial.jpa.bodytyp...@272111. I have added a
toString method to EnumDb that returns value.toString(), which allowed me
to get the value 'ONLINE' into my database instead of a memory address for
network presence as well as valid values in my smoker and drinker columns.
Thank you,
Gary F Stevens
chico charlesworth <[email protected]> wrote on 04/07/2009
03:17:01 AM:
> chico charlesworth <[email protected]>
> 04/07/2009 03:17 AM
>
> Please respond to
> [email protected]
>
> To
>
> [email protected]
>
> cc
>
> Subject
>
> Re: Implementing shindig-samples
>
> Hi Gary,
>
> Should be very easy to use Hibernate instead of EclipseLink by changing
the
> default persistence-unit in
> shindig/java/samples/src/main/resources/META-INF/persistence.xml.
>
> There are various persistence-units defined, and if you comment out the
> current 'default' persistence-unit and change the 'hibernate'
> persistence-unit to 'default', that should get you going i think.
>
> In regards to the AddressDb problem I can't say much right now, although
I
> think the shindig-samples module is most likely not up-to-date with the
> other shindig modules.
>
> Cheers
> Chico
>
> 2009/4/6 Gary Stevens <[email protected]>
>
> >
> > Chico,
> >
> > I have not tried using any other databases, just tried manipulating the
> > test cases to generate databases using different the persistence-units
> > listed in persistence.xml plugged into the SpiEntityManagerFactory
class.
> >
> > I did try rewriting the query as two separate expressions and seemed to
get
> > past the syntax error, but then I get errors about a missing column in
the
> > AddressDb table called Address_Usage. If I had to guess right now,
that
> > error may be from the fact that the social-api project has changes that
may
> > not yet be reflected in the samples project. I have not dug very deep
into
> > it yet.
> >
> > I have also noticed when starting my Jetty server I see messages in the
> > Eclipse console about the org.eclipse.persistence.session.file and says
the
> > version and build of the Eclipse Persistence Services (INFO:
EclipseLink,
> > version: Eclipse Persistence Services - 1.0 (Build 1.0 - 20080707)).
> >
> > Is there a setting somewhere in Shindig that I can change so that
something
> > other than EclipseLink (say, Hibernate) loads in its place?
> >
> > Thank you,
> > Gary F Stevens
> >
> > chico charlesworth <[email protected]> wrote on
04/04/2009
> > 07:03:09 AM:
> >
> > > chico charlesworth <[email protected]>
> > > 04/04/2009 07:03 AM
> > >
> > > Please respond to
> > > [email protected]
> > >
> > > To
> > >
> > > [email protected]
> > >
> > > cc
> > >
> > > Subject
> > >
> > > Re: Implementing shindig-samples
> > >
> > > Hi Gary,
> > >
> > > Have you tried with a different database, e.g. hsqldb or mysql, or
even
> > > making sure the version of derby you are using is the latest?
> > > My other thought would be to rewrite the JPQL query as two
expressions
> > and
> > > see if that works?
> > >
> > > Cheers
> > > Chico
> > >
> > > 2009/4/3 Gary Stevens <[email protected]>
> > >
> > > >
> > > >
> > > > Hello all,
> > > >
> > > > I have been trying to implement the data persistence samples
included
> > in
> > > > Shindig and hit a problem. I have set up a Derby\EclipseLink
database
> > with
> > > > the canonical data loaded into it and have tried to point my
Shindig at
> > it
> > > > instead of the canonicaldb.json file. My setup uses the
> > > > EclipseEntityManagerProvider class to create an implementation of
> > > > EntityManager and hits a snag inside of JPQLUtils.java's
> > getTotalResults
> > > > method. The query it builds starts "select count(*)..." and when I
> > load my
> > > > container I get a JPQL exception in my Eclipse console. The
message
> > reads:
> > > >
> > > > Syntax error parsing the query [select count(*) from PersonDb
p
> > where
> > > > p.objectId in (select f.friend.objectId from PersonDb p, FriendDb f
> > where
> > > > p.objectId = f.person.objectId and p.id in (?1)) ],
> > > > line 1, column 13: syntax error at [*].
> > > > Internal Exception: MismatchedTokenException(66!=70)
> > > >
> > > > From looking online, I am under the impression that the problem is
a
> > > > difference in syntax between SQL and JPA/JPQL - that you can use
the
> > > > annotation count(*) in SQL but not in JPQL because JPQL only allows
one
> > > > argument in count() but SQL allows multiple arguments. Is this the
> > > > problem, and I need to rewrite how the getTotalResults method
assembles
> > the
> > > > query? Or am I further away from having the persistence sample
working
> > > > than I think? If anyone else who has played around with the
included
> > > > samples can offer any advice as well it would be greatly
appreciated.
> > > >
> > > > Thank you,
> > > > - Gary F Stevens
> >