You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by hfriederichs <h....@ohra.nl> on 2012/05/12 11:21:38 UTC

Wicket and JPA: please a simple way to go

Hello,

I'm using wicket 1.5.4, and I tried various approaches in using Wicket and
JPA (using webshere/open jpa). I looked at several posts here, but I keep
ending up writing /more/ boiler plate code and configuration than with plain
old jdbc.
So.
I don't want to write factories. I don't want to write Managers. I don't
want to use Guice. I'd like to inject an EntityManager, but there's no
Servlet, and injecting it in a ServletContextListener obviously doesn't
work.
If your response is like: look at this forum for '....' please don't
respond.

Please help 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Josh Kamau <jo...@gmail.com>.
Use ebean then. Www.avaje.org  . You just add 1 properties file and you can
start persisting your jpa  entities

On 12 May 2012 12:58, "hfriederichs" <h....@ohra.nl> wrote:

I looked at it, shortly. It's a perfect example of what I mean. I looked at
a
blog by Igor V. And there we go again: you have to do this; and than that.
And then configure this. And don't forget to add a line in ....xml.
And in the end, put it all together and it's so great.

I don't think so.

I think JPA has to make life easier, and it does for me when I'm not using
Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
IMHO.

Of course, the CDI-blog goes with the usual great-gratitude-comments of
developers who couldn't figure it out either.

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html

Sent from the Users forum mailing list archive at Nabble.com.

-------------------------------------...

Re: Wicket and JPA: please a simple way to go

Posted by Igor Vaynberg <ig...@gmail.com>.
that example will work with websphere, or without it.

-igor

On Sat, May 12, 2012 at 1:15 PM, hfriederichs <h....@ohra.nl> wrote:
> Igor,
>
> I suspect you didn't realize when you got up this morning that at the end of
> the day you would acquire eternal fame, but there it is. To get it working
> with WebSphere is another matter; let's call it a challenge...
>
> I'll consider all the things mentioned here, thanks to you all.
>
> Regards etc...
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629413.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
Igor,

I suspect you didn't realize when you got up this morning that at the end of
the day you would acquire eternal fame, but there it is. To get it working
with WebSphere is another matter; let's call it a challenge... 

I'll consider all the things mentioned here, thanks to you all.

Regards etc...

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629413.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Igor Vaynberg <ig...@gmail.com>.
On Sat, May 12, 2012 at 10:23 AM, hfriederichs <h....@ohra.nl> wrote:
> Igor,
>
> Josh suggested CDI as an alternative, in that respect it's the same as other
> approaches I've tried: to cumbersome, to complex for my goals, so in respect
> to what I want I don't think it's great.
>
> I'll look into the wicket-jee module in wicketstuff, but it is yet another
> extra 'thingy' you need for something that's so simple and basic... I wonder
> if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
> components'. Maybe a quiz is a good idea. The Question is: fetch one row
> from a straightforward table in let's say an onclick of a wicket button,
> using jpa. The respondent that has the simplest solution gets eternal fame.

class JpaApplication extends WebApplication {
  EntityManagerFactory jpa;

  init() {  super.init(); jpa=Persistence.createEntityManagerFactory("demo"); }
  static JpaApplication get() { return (JpaApplication)application.get(); }
  EntityManager createEm() { return jpa.craeteEntityManager(); }
}

class MyPage extends WebPage {
  MyPage() {
     add(new Button("fetch") {
        onsubmit() {
           EntityManager em=JpaApplication.get().createEm();
           em.createQuery("FROM foo").setMaxResults(1).getResultList();
           em.close();
        }
    });}}

there you go. of course by the time you are done adapting this super
simple yet working example to something usable in an actual
application you will end up with something i described in my blog.

-igor

>
>> Of course, the CDI-blog goes with the usual great-gratitude-comments of
>> developers who couldn't figure it out either.
>
>>> whats wrong with that?
>
> Who says there's something wrong with that? It's just irony.
>
> Thanks anyways
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <jc...@carmanconsulting.com>.
Use the source, Luke!  The code is hosted at github currently.

https://github.com/jwcarman/Wicketopia
On May 13, 2012 1:07 PM, "Tom Eugelink" <tb...@tbee.org> wrote:

> Where? I get almost empty pages.
>
>
>   About Wicketopia Example Application
>
> A Rapid Application Development (RAD) library for the Apache Wicket
> framework
>
>
>
>
> On 2012-05-13 18:44, James Carman wrote:
>
>> There is a sample application by the way. It'll give you a good idea of
>> the
>> capabilities.
>> On May 13, 2012 12:18 PM, "James Carman"<jc...@carmanconsulting.com>
>> >
>> wrote:
>>
>>  Patches and contributions are welcome.
>>> On May 13, 2012 10:55 AM, "Tom Eugelink"<tb...@tbee.org>  wrote:
>>>
>>>  On 2012-05-13 13:49, James Carman wrote:
>>>>
>>>>  If your application is that simple, check out Wicketopia.
>>>>>
>>>>>  Always interesting, but the information (http://wicketopia.**
>>>> sourceforge.net/<http://**wicketopia.sourceforge.net/<http://wicketopia.sourceforge.net/>>)
>>>> is, ah, lacking?
>>>>  :-)
>>>>
>>>> Tom
>>>>
>>>>
>>>> ------------------------------****----------------------------**
>>>> --**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apa**che.org<http://apache.org>
>>>> <us...@wicket.apache.org>
>>>> >
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>

Re: Wicket and JPA: please a simple way to go

Posted by Tom Eugelink <tb...@tbee.org>.
Where? I get almost empty pages.


    About Wicketopia Example Application

A Rapid Application Development (RAD) library for the Apache Wicket framework




On 2012-05-13 18:44, James Carman wrote:
> There is a sample application by the way. It'll give you a good idea of the
> capabilities.
> On May 13, 2012 12:18 PM, "James Carman"<jc...@carmanconsulting.com>
> wrote:
>
>> Patches and contributions are welcome.
>> On May 13, 2012 10:55 AM, "Tom Eugelink"<tb...@tbee.org>  wrote:
>>
>>> On 2012-05-13 13:49, James Carman wrote:
>>>
>>>> If your application is that simple, check out Wicketopia.
>>>>
>>> Always interesting, but the information (http://wicketopia.**
>>> sourceforge.net/<http://wicketopia.sourceforge.net/>) is, ah, lacking?
>>>   :-)
>>>
>>> Tom
>>>
>>>
>>> ------------------------------**------------------------------**---------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <jc...@carmanconsulting.com>.
There is a sample application by the way. It'll give you a good idea of the
capabilities.
On May 13, 2012 12:18 PM, "James Carman" <jc...@carmanconsulting.com>
wrote:

> Patches and contributions are welcome.
> On May 13, 2012 10:55 AM, "Tom Eugelink" <tb...@tbee.org> wrote:
>
>>
>> On 2012-05-13 13:49, James Carman wrote:
>>
>>> If your application is that simple, check out Wicketopia.
>>>
>>
>> Always interesting, but the information (http://wicketopia.**
>> sourceforge.net/ <http://wicketopia.sourceforge.net/>) is, ah, lacking?
>>  :-)
>>
>> Tom
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

Re: Wicket and JPA: please a simple way to go

Posted by James Carman <jc...@carmanconsulting.com>.
Patches and contributions are welcome.
On May 13, 2012 10:55 AM, "Tom Eugelink" <tb...@tbee.org> wrote:

>
> On 2012-05-13 13:49, James Carman wrote:
>
>> If your application is that simple, check out Wicketopia.
>>
>
> Always interesting, but the information (http://wicketopia.**
> sourceforge.net/ <http://wicketopia.sourceforge.net/>) is, ah, lacking?
>  :-)
>
> Tom
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket and JPA: please a simple way to go

Posted by Tom Eugelink <tb...@tbee.org>.
On 2012-05-13 13:49, James Carman wrote:
> If your application is that simple, check out Wicketopia.

Always interesting, but the information (http://wicketopia.sourceforge.net/) is, ah, lacking?  :-)

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
It isn't; the database requirements are. I expected to get that done in an
hour or so, so that I could quickly continue with the more advanced and
complex functions. In the end it cost me a day.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4632270.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <ja...@carmanconsulting.com>.
On Sun, May 13, 2012 at 7:19 AM, hfriederichs <h....@ohra.nl> wrote:
> Tom,
>
> I couldn't agree more, you hit the spot. Indeed it's all about balance,
> don't over- (nor under-)architecture things. My application will be used by
> maybe 5 people, and requires some very simple CRUD-implemetations on a
> database table with maybe 100 rows (eventually).

If your application is that simple, check out Wicketopia.  It might be
able to do a lot of what you need out of the box.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
Tom,

I couldn't agree more, you hit the spot. Indeed it's all about balance,
don't over- (nor under-)architecture things. My application will be used by
maybe 5 people, and requires some very simple CRUD-implemetations on a
database table with maybe 100 rows (eventually).

Here's what I will do: stick the EntityManagerFactory in the
WicketApplication's subclass as Igor suggested (OK, without injection, but
never use injection for injection's sake); same goes for UserTransactions
for the CUD-part; make a DatabaseFacadeThing with all the necessary actions;
that thing uses the WicketApplication's subclass and will be used by the
Wicket components when needed. As a matter of fact, I already did make it,
and it works fine. And there's only the JPA-obligatory persistence.xml, no
other configs, components, and whatsoever.

Igor, thanks again for your 'dry swum code sample'. Btw: em.close() is not
allowed in a container-managed entity manager (JPA 5.9.1).

For all the other suggestions (not JPA): thank you, I will look at them,
just out of curiosity, because my 
company is a big, fat, obese insurance company, and big, fat, obese
creatures don't move a lot and don't like to move.
So it is JPA, and it will be so for ever and ever, in line with the
company's daily definition of 'ever and ever'.

Regards, Hans

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630326.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
Martin Grigorov-4 wrote
> 
> Apart of that, doing manual transaction management is just silly.
> Better let the "layers" to do this for you instead of spreading such
> kind of logic all over your code.
> 

Martin,

I have that logic at one place in my little silly application, and it's
perfect for it's goal, without config thingies, and the chance of big
changes in the future are zero. So let's not talk of that, I'll give you
another example - this time on a huge scale. 
My company is, as I mentioned earlier on, a big fat insurance company. As
all other companies in this branch, we started some ten years ago with the
biggest layer of decoupling there is: a centralized SOA/ESB.
And it turned out to be an enormous fiasco, it overcomplicated things on a
huge scale and has cost millions and millions. (It did generate a lot of
interesting work for me and lots of colleagues, though.) 
And now we are dismantling it, and turning back to point-to-point solutions.
As a result, things are getting more stable every day... And no, we are not
experiencing the disadvantages of the 'spaghetti' of zillions of
point-to-point connections, because there aren't so many. And yes, it's
great that we're having less and less 'scattered' functionality, like hidden
business rules in vetro-actions.
To be short: we didn't need it, and we better had not done it.

Hans



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641131.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Martijn Dashorst <ma...@gmail.com>.
Just an FYI: there is no need to add Label's for internationalization
purposes per se:

<wicket:message key="..." />

will work wonders for this kind of stuff.

But I agree that for 5 users for an internal app where folks really
are dutch, even that would be overkill when compared to

<label for="..">Naam</label>

Martijn

On Wed, May 16, 2012 at 12:01 PM, Tom Eugelink <tb...@tbee.org> wrote:
>
> On 16-5-2012 11:52, Martin Grigorov wrote:
>>
>>
>> Using a resource bundle for i18n has this big benefit for me: all my
>> translations are in *one* place.
>
>
> But if the app does not have translations as a requirement?
>
>
>
>> But this is your app... Ignore me.
>
>
> That would be unfriendly :-)
>
> Tom
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Tom Eugelink <tb...@tbee.org>.
On 16-5-2012 11:52, Martin Grigorov wrote:
>
> Using a resource bundle for i18n has this big benefit for me: all my
> translations are in *one* place.

But if the app does not have translations as a requirement?


> But this is your app... Ignore me.

That would be unfriendly :-)

Tom



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, May 16, 2012 at 11:42 AM, Tom Eugelink <tb...@tbee.org> wrote:
>
> On 16-5-2012 11:29, Martin Grigorov wrote:
>>
>> On Wed, May 16, 2012 at 11:18 AM, hfriederichs<h....@ohra.nl>
>>  wrote:
>>>
>>> Just an afterthought - I can't figure out the English word for the Dutch
>>>
>>> 'nabrander'. As it happens, my afterthought has to do with another
>>> (non-existing) Dutch word: /hoevaakheid/. Translated to English you would
>>> also get an non-existing word: /howoftenness/.
>>> Maybe that's funny, maybe not.
>>> But apart from that, I think howoftenness is a very important and often
>>> neglected concept. And your example is a perfect application of good use
>>> of
>>> howoftenness.
>>> How many 'layers of decoupling' have been written that turned out to be
>>> useless... Had one only thought of howoftenness...
>>
>> If you create an app with 2 pages then these layers look useless
>> indeed, but if you create a bigger app then you will see how all this
>> becomes useful.
>> You'll configure the "layers" once (it will take you a day or two) but
>> after that you will just inject the EntityManager and use it in PageN,
>> and this will return your initial investment.
>> Apart of that, doing manual transaction management is just silly.
>> Better let the "layers" to do this for you instead of spreading such
>> kind of logic all over your code.
>>
>
> In my opinion both are correct. Some layers need to be in from the start,
> because putting them in afterwards is a tremendous effort (e.g. separation
> of concern). Some layers should only be put in if the requirements actually
> requires them or it is reasonable to expect it to become a requirement (e.g.
> internationalization), or when the abstraction actually would be saving

Using a resource bundle for i18n has this big benefit for me: all my
translations are in *one* place.
Even if I know in which component (either in Java or in HTML) I've put
some label now I will forget this useless knowledge after a few
months. Then I'll have to grep over my source to find where is it and
change it. And most probably you wont support that app forever.
It will be even more frustrating for the one after you.

By having them all in one file I can just open this file, search for
the term and change it. This way all places that use it will be
updated in one shot.

But this is your app... Ignore me.

> effort (spreading of code). For example: the need to type "Name" in the html
> and in the setLabel does IMHO not justify in the resource files abstraction.
> I'd also need to keep the ID for fetching the label in two locations in
> sync, which is the same effort. Or I would also need to add an additional
> abstraction by using a central list of java string constants.
>
> Fetching an EM should happen only in one place, because that is most
> definitely a separate concern. But how complex that must be can evolve from
> a simple setup to quantum logic. I currently have a fetch EM logic in a
> Swing application that evolved to being based on open JFrames and active
> focus.
>
> Topm
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Tom Eugelink <tb...@tbee.org>.
On 16-5-2012 11:29, Martin Grigorov wrote:
> On Wed, May 16, 2012 at 11:18 AM, hfriederichs<h....@ohra.nl>  wrote:
>> Just an afterthought - I can't figure out the English word for the Dutch
>> 'nabrander'. As it happens, my afterthought has to do with another
>> (non-existing) Dutch word: /hoevaakheid/. Translated to English you would
>> also get an non-existing word: /howoftenness/.
>> Maybe that's funny, maybe not.
>> But apart from that, I think howoftenness is a very important and often
>> neglected concept. And your example is a perfect application of good use of
>> howoftenness.
>> How many 'layers of decoupling' have been written that turned out to be
>> useless... Had one only thought of howoftenness...
> If you create an app with 2 pages then these layers look useless
> indeed, but if you create a bigger app then you will see how all this
> becomes useful.
> You'll configure the "layers" once (it will take you a day or two) but
> after that you will just inject the EntityManager and use it in PageN,
> and this will return your initial investment.
> Apart of that, doing manual transaction management is just silly.
> Better let the "layers" to do this for you instead of spreading such
> kind of logic all over your code.
>

In my opinion both are correct. Some layers need to be in from the start, because putting them in afterwards is a tremendous effort (e.g. separation of concern). Some layers should only be put in if the requirements actually requires them or it is reasonable to expect it to become a requirement (e.g. internationalization), or when the abstraction actually would be saving effort (spreading of code). For example: the need to type "Name" in the html and in the setLabel does IMHO not justify in the resource files abstraction. I'd also need to keep the ID for fetching the label in two locations in sync, which is the same effort. Or I would also need to add an additional abstraction by using a central list of java string constants.

Fetching an EM should happen only in one place, because that is most definitely a separate concern. But how complex that must be can evolve from a simple setup to quantum logic. I currently have a fetch EM logic in a Swing application that evolved to being based on open JFrames and active focus.

Topm


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, May 16, 2012 at 11:18 AM, hfriederichs <h....@ohra.nl> wrote:
>
> Tom Eugelink wrote
>>
>> For example, wicket convention dictates that all labels should be put in
>> property files. I decided not to do that. I fully understand the
>> advantages, but for this project I'm simply not going to add an additional
>> label component and a property file just to get "Name" on the screen. Yes,
>> if it must be internationalized I have to rework my code, but as it stands
>> the application probably won't have to be, and I would have added the
>> abstraction for nothing.
>>
>>
>
> Tom,
>
> Just an afterthought - I can't figure out the English word for the Dutch
> 'nabrander'. As it happens, my afterthought has to do with another
> (non-existing) Dutch word: /hoevaakheid/. Translated to English you would
> also get an non-existing word: /howoftenness/.
> Maybe that's funny, maybe not.
> But apart from that, I think howoftenness is a very important and often
> neglected concept. And your example is a perfect application of good use of
> howoftenness.
> How many 'layers of decoupling' have been written that turned out to be
> useless... Had one only thought of howoftenness...

If you create an app with 2 pages then these layers look useless
indeed, but if you create a bigger app then you will see how all this
becomes useful.
You'll configure the "layers" once (it will take you a day or two) but
after that you will just inject the EntityManager and use it in PageN,
and this will return your initial investment.
Apart of that, doing manual transaction management is just silly.
Better let the "layers" to do this for you instead of spreading such
kind of logic all over your code.

>
> Hans
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641067.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
Tom Eugelink wrote
> 
> For example, wicket convention dictates that all labels should be put in
> property files. I decided not to do that. I fully understand the
> advantages, but for this project I'm simply not going to add an additional
> label component and a property file just to get "Name" on the screen. Yes,
> if it must be internationalized I have to rework my code, but as it stands
> the application probably won't have to be, and I would have added the
> abstraction for nothing.
> 
> 

Tom,

Just an afterthought - I can't figure out the English word for the Dutch
'nabrander'. As it happens, my afterthought has to do with another
(non-existing) Dutch word: /hoevaakheid/. Translated to English you would
also get an non-existing word: /howoftenness/.
Maybe that's funny, maybe not. 
But apart from that, I think howoftenness is a very important and often
neglected concept. And your example is a perfect application of good use of
howoftenness.
How many 'layers of decoupling' have been written that turned out to be
useless... Had one only thought of howoftenness...

Hans

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4641067.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Tom Eugelink <tb...@tbee.org>.
Chiming in;

As it happens I'm currently working on a NoSQL (Cassandra) project and found a JPA implementation for Cassandra (http://code.google.com/p/kundera/). Currently JPA is the most used persistency API in Java, allowing for binding with RDBMS, XML, NoSQL. I decided not to use it, BTW, but that is because of other considerations.

To also have an quick opinion on the rest of the thread (as I understand it). Java projects have a tendency to over complicate and bloat. For example, wicket convention dictates that all labels should be put in property files. I decided not to do that. I fully understand the advantages, but for this project I'm simply not going to add an additional label component and a property file just to get "Name" on the screen. Yes, if it must be internationalized I have to rework my code, but as it stands the application probably won't have to be, and I would have added the abstraction for nothing.

Same goes for the 6 line JPA example a few posts back. If it works, great, just use it as is. Why make it more complex from the start? Refactor if you need to, not overarchitecture in advance.

I found that this pragmatic style (mind you; it's all a balance, you can't skip every corner), usually delivers results "PHP style" fast, but still has "Java quality" architecture in the overall setup. And even with all refactoring counted in, it stays well within budget; I'm currently aiming to complete my project in 75% of the "Java architecture" estimate. ;-)

Coming full circle; one of the corners you can't cut is clear separation of concern. So extracting the model (JPA) from the presentation (wicket) is very important.

My 2 euro cents. And thanks for a well though through framework, I'm warming up to it.

Tom


On 2012-05-13 09:51, dhar_ar@yahoo.com wrote:
> Has your company heard of NOSQL?
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by dh...@yahoo.com.
Has your company heard of NOSQL?

JPA is a standard and I agree with most of it, but there are times when good ol iBatis is more straight forward.

Looking at the future there are non RDBMS related databases; JPA is the way to go depending on where you are going.

For a community building a framework, they have to consider the community and not just a single line of thought. 

If you still feel that a single stack of technologies that provides a 360 degree coverage. Check out "PLAY" !

They have re invented the paridgm and are ready to even discard the servlet specification (or make it optional)

I don't like that aspect of Play, but looks like you may enjoy it more. Its nice for that I could critcize it.

Wicke ftw for the rest.
Good luck


Sent from BlackBerry® on Airtel

-----Original Message-----
From: hfriederichs <h....@ohra.nl>
Date: Sun, 13 May 2012 00:23:32 
To: <us...@wicket.apache.org>
Reply-To: users@wicket.apache.org
Subject: RE: Wicket and JPA: <i>please</i> a simple way to go

All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
All standards are equal, but some (like JPA) are more equal than others,
that's what you mean?

Well, a short look at the history of computing shows that technologies with
obvious and proven qualities, 
unanimously supported by experts, sometimes still don't survive. Other
qualities are needed...

In my company, JPA is the way to go.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4630088.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket and JPA: please a simple way to go

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>James, what is technology specific about JPA?

You assume that because JPA is a standard it must be the only standard.
A lot of people would take offense to that.

Have you heard of JDO? It was around long before JPA, is much more
mature, still actively enhanced and many who use it do so because they
believe it to be superior because it wasn't written with the design goal
of 'constrain it sufficiently so that a popular ORM is capable of
implementing it'. That's why JDO can work with all the RDBMSes and the
NoSQLs, GAE, Mongo, OODBs etc.,

>
>--
>View this message in context: http://apache-
>wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-
go-
>tp4628562p4629309.html
>Sent from the Users forum mailing list archive at Nabble.com.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <ja...@carmanconsulting.com>.
On Sat, May 12, 2012 at 3:42 PM, hfriederichs <h....@ohra.nl> wrote:
> And I think I´m missing your point: I still don't get what's technology
> specific about JPA. Isn't it just a Java API like JMS or JaxWS?
>

Yes, JPA is *an* API, but it's not the only persistence API out there.
 If Wicket were to "pick a favorite", then of course there would be
folks out there that wouldn't like it.  So, it doesn't.  However,
there are plenty of add-on modules for you to choose from that make it
much easier for you to use your API of choice.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
I have things working, in two versions: one with a
'PersistenceManagerSingleton' I wrote, ugly, and one based on jndi-lookups
of both the EntityManager and the UserTransaction, ugly too, for sticking to
jndi-lookups. A third I am thinking of is create an EJB-project alongside my
WebModule, so I can do my Injection stuff there. A fourth could be the
wicketstuff JEE-module.

I think you're missing my point. It doesn´t matter that there are loads of
examples. As I see it, they are all far too complex for such simple a task.

And I think I´m missing your point: I still don't get what's technology
specific about JPA. Isn't it just a Java API like JMS or JaxWS?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629356.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <ja...@carmanconsulting.com>.
What if people want to use Hibernate?  What if people want to use
Cayenne?  What if people want to use iBatis/myBatis?  What if folks
want to use just plain ole JDBC?

The point is that the "core" of Wicket tries to stay as uncluttered as
possible, relying upon add-on modules to adapt it to other
environments (such as JEE like you're used to).  I would suggest you
take a look at the examples folks are showing you and play with them.
I think you'll find that the boilerplate stuff you have to do drops
off considerably after you get things working the way you want.  There
are even maven archetypes out there (legup is one I think others are
using) to help you get a fully working version set up in no time.

On Sat, May 12, 2012 at 3:05 PM, hfriederichs <h....@ohra.nl> wrote:
> James, what is technology specific about JPA?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629309.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
James, what is technology specific about JPA?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629309.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by James Carman <jc...@carmanconsulting.com>.
Wicket core tries to stay "stack agnostic".  If you want technology
specific stuff, you have to use extra modules.
On May 12, 2012 1:23 PM, "hfriederichs" <h....@ohra.nl> wrote:

> Igor,
>
> Josh suggested CDI as an alternative, in that respect it's the same as
> other
> approaches I've tried: to cumbersome, to complex for my goals, so in
> respect
> to what I want I don't think it's great.
>
> I'll look into the wicket-jee module in wicketstuff, but it is yet another
> extra 'thingy' you need for something that's so simple and basic... I
> wonder
> if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
> components'. Maybe a quiz is a good idea. The Question is: fetch one row
> from a straightforward table in let's say an onclick of a wicket button,
> using jpa. The respondent that has the simplest solution gets eternal fame.
>
> > Of course, the CDI-blog goes with the usual great-gratitude-comments of
> > developers who couldn't figure it out either.
>
> >> whats wrong with that?
>
> Who says there's something wrong with that? It's just irony.
>
> Thanks anyways
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
Igor, 

Josh suggested CDI as an alternative, in that respect it's the same as other
approaches I've tried: to cumbersome, to complex for my goals, so in respect
to what I want I don't think it's great.

I'll look into the wicket-jee module in wicketstuff, but it is yet another
extra 'thingy' you need for something that's so simple and basic... I wonder
if anyone has ever coined the phrase 'boiler plate xml' or 'boiler plate
components'. Maybe a quiz is a good idea. The Question is: fetch one row
from a straightforward table in let's say an onclick of a wicket button,
using jpa. The respondent that has the simplest solution gets eternal fame.

> Of course, the CDI-blog goes with the usual great-gratitude-comments of
> developers who couldn't figure it out either.

>> whats wrong with that?

Who says there's something wrong with that? It's just irony.

Thanks anyways

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4629186.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Igor Vaynberg <ig...@gmail.com>.
On Sat, May 12, 2012 at 2:58 AM, hfriederichs <h....@ohra.nl> wrote:
> I looked at it, shortly. It's a perfect example of what I mean. I looked at a
> blog by Igor V. And there we go again: you have to do this; and than that.
> And then configure this. And don't forget to add a line in ....xml.
> And in the end, put it all together and it's so great.

my blog explains how to create an application architecture based on
conversations. once its set up you dont have to touch it again and it
makes life much simpler whether you are using wicket or not. very
little of the article has to do with wicket itself.

> I don't think so.

thats nice.

> I think JPA has to make life easier, and it does for me when I'm not using
> Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
> IMHO.

when you are not using it with wicket what are you using it with?
websphere and servlets? sounds like websphere is using JEE to manage
jpa for you, so use wicket-jee module in wicketstuff. it will allow
you to inject the EntityManager into wicket components.

-igor


> Of course, the CDI-blog goes with the usual great-gratitude-comments of
> developers who couldn't figure it out either.

whats wrong with that?

-igor
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by hfriederichs <h....@ohra.nl>.
I looked at it, shortly. It's a perfect example of what I mean. I looked at a
blog by Igor V. And there we go again: you have to do this; and than that.
And then configure this. And don't forget to add a line in ....xml.
And in the end, put it all together and it's so great. 

I don't think so. 

I think JPA has to make life easier, and it does for me when I'm not using
Wicket: inject an EntityManager and do my db-stuff. That's how it should be,
IMHO.

Of course, the CDI-blog goes with the usual great-gratitude-comments of
developers who couldn't figure it out either.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562p4628598.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket and JPA: please a simple way to go

Posted by Josh Kamau <jo...@gmail.com>.
You dont want to use cdi either?

On 12 May 2012 12:22, "hfriederichs" <h....@ohra.nl> wrote:

Hello,

I'm using wicket 1.5.4, and I tried various approaches in using Wicket and
JPA (using webshere/open jpa). I looked at several posts here, but I keep
ending up writing /more/ boiler plate code and configuration than with plain
old jdbc.
So.
I don't want to write factories. I don't want to write Managers. I don't
want to use Guice. I'd like to inject an EntityManager, but there's no
Servlet, and injecting it in a ServletContextListener obviously doesn't
work.
If your response is like: look at this forum for '....' please don't
respond.

Please help

--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-and-JPA-i-please-i-a-simple-way-to-go-tp4628562.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org