Configuring JPA with Rife

0 views
Skip to first unread message

Rahul

unread,
Mar 31, 2009, 1:21:51 AM3/31/09
to rife-users
Hi, I am new to Rife... I am trying to configure JPA for my rife
project.. not sure about how to
go about it. Can anyone help me out regarding the same with any sort
of sample code regarding
the same.
Any help woyld be highly appreciated.
Message has been deleted

Geert Bevin

unread,
Mar 31, 2009, 2:00:11 AM3/31/09
to rife-...@googlegroups.com
Hi, you can use JPA alongside RIFE as you would in any Java
application. However, to benefit from the DB goodies of RIFE and the
rest of the stack that's built with those in mind, you need to use
RIFE's persistence library. Nothing prevents you from using both at
the same time though, you can use the same datasources.

HTH,

Geert
--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Flytecase Band - http://flytecase.be
Music and words - http://gbevin.com

Rahul

unread,
Mar 31, 2009, 2:28:47 AM3/31/09
to rife-users
I am trying to configure JPA for my rife application.
I have a file persistence.xml containing configuration
for persistence. But i am not able to initialize this file.
I am trying to add this as a new participant in my participants.xml
file
like this
<participant param="rep/persistence.xml">ParticipantPersistence</
participant>

it gives me error

SEVERE: Exception starting filter RIFE
com.uwyn.rife.rep.exceptions.ParticipantNotFoundException: The
participant 'ParticipantPersistence' couldn't be found.

Can anyone tell me how can i inject this file to my rife application.

On Mar 31, 11:00 am, Geert Bevin <gbe...@uwyn.com> wrote:
> Hi, you can use JPA alongside RIFE as you would in any Java  
> application. However, to benefit from the DB goodies of RIFE and the  
> rest of the stack that's built with those in mind, you need to use  
> RIFE's persistence library. Nothing prevents you from using both at  
> the same time though, you can use the same datasources.
>
> HTH,
>
> Geert
>
> On 31 Mar 2009, at 07:23, Rahul wrote:
>
>
>
> > Hi, I am new to Rife... I am trying to configure JPA for my rife
> > project.. not sure about how to
> > go about it. Can anyone help me out regarding the same with any sort
> > of sample code regarding
> > the same.
> > Any help woyld be highly appreciated.
>
> --
> Geert Bevin
> Terracotta -http://www.terracotta.org
> Uwyn "Use what you need" -http://uwyn.com

Geert Bevin

unread,
Mar 31, 2009, 2:30:49 AM3/31/09
to rife-...@googlegroups.com
Did you write your own ParticipantPersistence class? You need to use
the package name also then. If you don't specify a package name, RIFE
assumes it's one of the standard participants in
com.uwyn.rife.rep.participants.

Best regards,

Geert

Rahul

unread,
Mar 31, 2009, 2:37:19 AM3/31/09
to rife-users
No, I havnt written any class ParticipantPersistence, do I need to
write it, if yes then do i need to implement the interface Participant
and
define those methods of that interface?

Geert Bevin

unread,
Mar 31, 2009, 2:47:36 AM3/31/09
to rife-...@googlegroups.com
Yes, you can search the mailinglist if you need more information and
there's some docs in the wiki about this too.

Best regards,

Geert

Rahul

unread,
Mar 31, 2009, 3:31:49 AM3/31/09
to rife-users
Is there a way to define mapping between the tables in Rife, as we do
in hibernate or JPA for that matter.
In hibernate i used hbm configuration files and with JPA i used
annotations to define it.
How can i do it with rife?

Geert Bevin

unread,
Mar 31, 2009, 3:36:38 AM3/31/09
to rife-...@googlegroups.com
With RIFE it's based on naming convention, the tables correspond to
the names of your bean classes.

Rahul

unread,
Mar 31, 2009, 3:44:25 AM3/31/09
to rife-users
Yes, thats correct. Lets say I am registering a new user(user table)
to the db with corresponding role(role table).
I have a realtionship table with userid and roleid as foreign keys to
the user_role_mapping(user_role_mapping table)
mapping table.
I just want to save the user and corresponding entry should be made to
the user_role_mapping table.

How can I go about it.

Is there any link or any sample example which i can look forward to.
As i have looked into many examples
but i didnt find one according to my requirement.

Thanks

Geert Bevin

unread,
Mar 31, 2009, 3:48:37 AM3/31/09
to rife-...@googlegroups.com
I think this test could help you:
http://svn.rifers.org/rife/trunk/src/unittests/com/uwyn/rife/database/querymanagers/generic/TestGenericQueryManagerManyToOne.java

It uses the beans that are here:
http://svn.rifers.org/rife/trunk/src/unittests/com/uwyn/rifetestmodels/

HTH,

Geert

On 31 Mar 2009, at 09:44, Rahul wrote:

>
> Yes, thats correct. Lets say I am registering a new user(user table)
> to the db with corresponding role(role table).
> I have a realtionship table with userid and roleid as foreign keys to
> the user_role_mapping(user_role_mapping table)
> mapping table.
> I just want to save the user and corresponding entry should be made to
> the user_role_mapping table.
>
> How can I go about it.
>
> Is there any link or any sample example which i can look forward to.
> As i have looked into many examples
> but i didnt find one according to my requirement.

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com

Reply all
Reply to author
Forward
0 new messages