You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2007/08/29 09:54:43 UTC

JPA Examples (was: Re: Setup tutorial?)

On Aug 28, 2007, at 2:59 PM, deniskulik wrote:

> David Blevins wrote:
>> On Aug 27, 2007, at 11:50 AM, deniskulik wrote:
>>
>>> I will try to look at how things work with jpa, ejbs, mdbs and etc
>>> more
>>> closely. Can anyone please point me to the place where I could find
>>> more or
>>> less up to date info on how they can be configured?
>>
>> We're working on more examples:  http://issues.apache.org/jira/ 
>> browse/
>> OPENEJB-342
>>
>
> Perhaps I could throw in some examples mentioned on the list if you  
> dont
> mind. Already have a couple of persistence examples, just need to  
> polish
> them off slightly.

Absolutely, Denis.  That'd be fantastic.  We love to see new people  
helping out, so welcome to the team! :)  And definitely feel welcome  
to dig into anything, make all the suggestions you want and ask all  
the questions you want.

If you let me know your jira id I can add you to the openejb- 
contributors group and assign you any example you'd like.

I think we may have some issues with persistence.xml support when  
people go off the "happy path".  Trying to get an app deployment to  
fail due to bad jpa setup and not getting the kind of feedback I  
would expect.

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by David Blevins <da...@visi.com>.
On Dec 8, 2007, at 6:25 AM, Jacek Laskowski wrote:

> On Dec 8, 2007 9:14 AM, David Blevins <da...@visi.com> wrote:
>
>> It shows a Stateful bean using an EntityManager with EXTENDED
>> persistence type so the entities won't detach between calls to the
>> Stateful bean as they would if when using TRANSACTION (i.e. jta
>> scoped) persistence.
>
> ...or if using @Stateless. EXTENDED is applicable to @Stateful only.
> One of the reasons @Stateful's so handy.

Exactly.  Last night I added a validation JIRA on this exact thought  
too:

     [OPENEJB-730] Validation: Attempted use of  
PersistenceContextType.EXTENDED by non-Stateful bean

Currently, we aren't checking that people are trying to use EXTENDED  
with Stateless.  I tried it last night and the app totally deployed  
without a peep and just failed silently at runtime.

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Dec 8, 2007 9:14 AM, David Blevins <da...@visi.com> wrote:

> It shows a Stateful bean using an EntityManager with EXTENDED
> persistence type so the entities won't detach between calls to the
> Stateful bean as they would if when using TRANSACTION (i.e. jta
> scoped) persistence.

...or if using @Stateless. EXTENDED is applicable to @Stateful only.
One of the reasons @Stateful's so handy.

p.s. I had a EJB3 presentation on a Poznan University yesterday. It
took me over 3 hours to talk about it - lots of examples and topic
around EJB3 and JPA and I had only scratched the EJB3/JPA surface. I
had done it with Glassfish as it's nicely integrated with NetBeans IDE
6 that provides features for Java EE development beyond those I could
find in Eclipse (I'm not talking about RAD7.5 though that's around the
corner). Ok, gonna start another thread about it.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JPA Examples (was: Re: Setup tutorial?)

Posted by David Blevins <da...@visi.com>.
On Nov 24, 2007, at 6:45 PM, openejber wrote:

>
> my replies were kept blocked last couple of days....
>
> indeed, i'd like to see a JPA example below,
>
> - a non-servlet normal unit test class looking up and casting an ejb  
> bean's
> local proxy object(namely OPENEJB IntraVM mode?), which does CRUD on  
> an
> entity
> - a local ejb interface defining CRUD methods
> - a bmt-ejb bean injected with the persistence context consisting of  
> that
> entity, and the bean implementing that ejb interface
> - finally, the entity class itself

Have a new example here that shows JPA usage.  Ant and Maven build  
scripts included.

http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/injection-of-entitymanager/

It shows a Stateful bean using an EntityManager with EXTENDED  
persistence type so the entities won't detach between calls to the  
Stateful bean as they would if when using TRANSACTION (i.e. jta  
scoped) persistence.

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by openejber <fa...@yahoo.com>.

CORRECTION: a cmt-ejb bean instead of a bmt-ejb bean 

my replies were kept blocked last couple of days.... 

indeed, i'd like to see a JPA example below, 

- a non-servlet normal unit test class looking up and casting an ejb bean's
local proxy object(namely OPENEJB IntraVM mode?), which does CRUD on an
entity 
- a local ejb interface defining CRUD methods 
- a bmt-ejb bean injected with the persistence context consisting of that
entity, and the bean implementing that ejb interface 
- finally, the entity class itself 

thx! 

-- 
View this message in context: http://www.nabble.com/JPA-Examples-%28was%3A-Re%3A-Setup-tutorial-%29-tf4346259.html#a13932241
Sent from the OpenEJB Dev mailing list archive at Nabble.com.


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by openejber <fa...@yahoo.com>.
my replies were kept blocked last couple of days....

indeed, i'd like to see a JPA example below,

- a non-servlet normal unit test class looking up and casting an ejb bean's
local proxy object(namely OPENEJB IntraVM mode?), which does CRUD on an
entity 
- a local ejb interface defining CRUD methods
- a bmt-ejb bean injected with the persistence context consisting of that
entity, and the bean implementing that ejb interface
- finally, the entity class itself

thx!
 

David Blevins wrote:
> 
> 
> On Nov 20, 2007, at 12:37 AM, Jacek Laskowski wrote:
> 
>> On Nov 20, 2007 2:21 AM, David Blevins <da...@visi.com> wrote:
>>
>>> We don't have any JPA examples yet.  Dario has some in his blog  
>>> though:
>>
>> Hi,
>>
>> So what's persistence.xml for in ejb-examples? There's
>> <class>org.apache.openejb.examples.servlet.JpaBean</class> and the
>> class looks as @Entity:
>>
>> @Entity
>> public class JpaBean {
>>    @Id
>>    @GeneratedValue(strategy = GenerationType.IDENTITY)
>>    @Column(name = "id")
>>    private int id;
>>
>> What examples would you think of?
> 
> I forgot about Dain's servlet examples.  They only run in Tomcat and  
> have no unit tests.
> 
> I was thinking about OPENEJB-360 which would show an ejb using jpa  
> along with a unit test to show embedded testing.
> 
> -David
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JPA-Examples-%28was%3A-Re%3A-Setup-tutorial-%29-tf4346259.html#a13932094
Sent from the OpenEJB Dev mailing list archive at Nabble.com.


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by David Blevins <da...@visi.com>.
On Nov 20, 2007, at 12:37 AM, Jacek Laskowski wrote:

> On Nov 20, 2007 2:21 AM, David Blevins <da...@visi.com> wrote:
>
>> We don't have any JPA examples yet.  Dario has some in his blog  
>> though:
>
> Hi,
>
> So what's persistence.xml for in ejb-examples? There's
> <class>org.apache.openejb.examples.servlet.JpaBean</class> and the
> class looks as @Entity:
>
> @Entity
> public class JpaBean {
>    @Id
>    @GeneratedValue(strategy = GenerationType.IDENTITY)
>    @Column(name = "id")
>    private int id;
>
> What examples would you think of?

I forgot about Dain's servlet examples.  They only run in Tomcat and  
have no unit tests.

I was thinking about OPENEJB-360 which would show an ejb using jpa  
along with a unit test to show embedded testing.

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Nov 20, 2007 2:21 AM, David Blevins <da...@visi.com> wrote:

> We don't have any JPA examples yet.  Dario has some in his blog though:

Hi,

So what's persistence.xml for in ejb-examples? There's
<class>org.apache.openejb.examples.servlet.JpaBean</class> and the
class looks as @Entity:

@Entity
public class JpaBean {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

What examples would you think of?

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JPA Examples (was: Re: Setup tutorial?)

Posted by David Blevins <da...@visi.com>.
On Nov 19, 2007, at 2:23 PM, Jacek Laskowski wrote:

> On Nov 19, 2007 9:53 PM, openejber <fa...@yahoo.com> wrote:
>
>> are these JPA Examples for openejb3 accessible now?:confused:  
>> couldn't find
>> from the Sep. beta release.
>
> Yes, they are at
> http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples. Grab
> them with
>
>  svn co http://svn.apache.org/repos/asf/openejb/trunk/openejb3/ 
> examples
> openejb3-examples
>
> and give them a shot with
>
>  mvn test
>
> Look at ejb-examples directory.
>
> I'm just working on another one for ejb3 interceptors so if you tell
> us what example you need I can easily create some for you. Just let us
> know.

We don't have any JPA examples yet.  Dario has some in his blog though:

   http://javanotebook.com/2007/09/28/openejb_3_and_tomcat_6.html

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by openejber <fa...@yahoo.com>.
both links point to the same repos (Revision 596492), right?! sure i'll come
back for more helps once get into trouble. thx! 
-- 
View this message in context: http://www.nabble.com/JPA-Examples-%28was%3A-Re%3A-Setup-tutorial-%29-tf4346259.html#a13848659
Sent from the OpenEJB Dev mailing list archive at Nabble.com.


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Nov 19, 2007 9:53 PM, openejber <fa...@yahoo.com> wrote:

> are these JPA Examples for openejb3 accessible now?:confused: couldn't find
> from the Sep. beta release.

Yes, they are at
http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples. Grab
them with

  svn co http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples
openejb3-examples

and give them a shot with

  mvn test

Look at ejb-examples directory.

I'm just working on another one for ejb3 interceptors so if you tell
us what example you need I can easily create some for you. Just let us
know.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JPA Examples (was: Re: Setup tutorial?)

Posted by openejber <fa...@yahoo.com>.
are these JPA Examples for openejb3 accessible now?:confused: couldn't find
from the Sep. beta release.

thx!
-- 
View this message in context: http://www.nabble.com/JPA-Examples-%28was%3A-Re%3A-Setup-tutorial-%29-tf4346259.html#a13844979
Sent from the OpenEJB Dev mailing list archive at Nabble.com.


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by David Blevins <da...@visi.com>.
On Aug 29, 2007, at 1:54 AM, deniskulik wrote:

> David Blevins wrote:
>>
>>
>> If you let me know your jira id I can add you to the openejb-
>> contributors group and assign you any example you'd like.
>>
>> I think we may have some issues with persistence.xml support when
>> people go off the "happy path".  Trying to get an app deployment to
>> fail due to bad jpa setup and not getting the kind of feedback I
>> would expect.
>>
>> -David
>>
>>
>
> Hi David
>
> My jira id is deniskulik, count me in for jpa examples first and I  
> will
> start going through the rest of them later.

Hi Denis,

I went ahead and added pretty basic jpa example.  It's not very  
complicated on the JPA side and if you're still looking to contribute  
any expansion of it would be great.  Some entity relationships would  
be fantastic.

-David


Re: JPA Examples ([jira] OPENEJB-360)

Posted by David Blevins <da...@visi.com>.
On Sep 5, 2007, at 11:09 PM, Jacek Laskowski wrote:

> On 8/29/07, deniskulik <de...@ukonline.co.uk> wrote:
>
>> My jira id is deniskulik
>
> It's in openejb-contributor group. Welcome aboard!

Yea, welcome!  I've also assign you OPENEJB-360 "Example: Using JPA"

If you don't think you'll get around to it, just let us know and  
we'll put it back into the pool.

-David


Re: JPA Examples (was: Re: Setup tutorial?)

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 8/29/07, deniskulik <de...@ukonline.co.uk> wrote:

> My jira id is deniskulik

It's in openejb-contributor group. Welcome aboard!

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JPA Examples (was: Re: Setup tutorial?)

Posted by deniskulik <de...@ukonline.co.uk>.


David Blevins wrote:
> 
> 
> If you let me know your jira id I can add you to the openejb- 
> contributors group and assign you any example you'd like.
> 
> I think we may have some issues with persistence.xml support when  
> people go off the "happy path".  Trying to get an app deployment to  
> fail due to bad jpa setup and not getting the kind of feedback I  
> would expect.
> 
> -David
> 
> 

Hi David

My jira id is deniskulik, count me in for jpa examples first and I will
start going through the rest of them later.

Denis
-- 
View this message in context: http://www.nabble.com/JPA-Examples-%28was%3A-Re%3A-Setup-tutorial-%29-tf4346259.html#a12383149
Sent from the OpenEJB Dev mailing list archive at Nabble.com.