You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Kenneth Fogel <kf...@dawsoncollege.qc.ca> on 2020/02/14 05:51:59 UTC

JPA Controller Generation

I have been using NetBeans, as many of you know, for years. In the winter I teach an EE course that uses the JPA. In using the New -> JPA Controllers from Entities I couldn’t believe what came out. Let’s review two changes:

If the persistence.xml file does not declare a connection (url, user, pwd) the generated controllers are empty. When this file is used for EE JPA you declare the connection in glassfish-resources.xml and not the persistence.xml. Previous versions of NB did show the connection details but if I edited for EE JPA and then generated the controllers they were still generated. The controllers are generated from the entities so why is the generator even looking at persistence.xml.

Then there are the controllers themselves. They have been optimized for stand alone, resource local usage. The optimizations, especially the use of finally clauses to eliminate catch clauses makes no sense to me. Many but not all exceptions simply result in an em.close(). This is effectively the same as having an empty catch clause. Plus, with an injected  EntityManager you should not be closing it, if I understand how CDI works. There is no rollback anywhere. If the JPA now rolls back automatically when an exception occurs I’ll withdraw this complaint but I doubt it does.

I could go on. If you want to see what controllers used to look like and what had to be changed for EE look at my blog https://www.omniprogrammer.com/?p=383.

Is the JPA used more extensively on the desktop? I don’t think so. Here I take the blame for not pointing out that there needs to be JPA generation for Application Servers. If you look at my blog you can see that the changes were minimal to the old generated code. Now the changes will need to be more extensive.

I have to stop now because I’m angry. Tomorrow morning I have to face a class and before that I need to decide if I should tell them to cut and paste code from my samples and change the names of objects or show them all the changes needed to make the generated code work.

Please tell me I have it all wrong and I’ll be happy to apologize for this missive and never darken this mailing list again. I will also be happy to contribute JPA/EE controller templates if my concerns are valid.

Ken






Re: JPA Controller Generation

Posted by Josh Juneau <ju...@gmail.com>.
Thanks so much, I appreciate it.


Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/us/search?query=Juneau
<https://www.apress.com/index.php/author/author/view/id/1866>



On Tue, Feb 18, 2020 at 10:54 AM Kenneth Fogel <kf...@dawsoncollege.qc.ca>
wrote:

> Done. I have filed three issues on JIRA. I placed the pdf on github and
> put the url to the document into the description. When I have some time I
> will look at the source code as Geertjan suggested.
>
> Ken
>
> -----Original Message-----
> From: Josh Juneau <ju...@gmail.com>
> Sent: February 17, 2020 10:01 AM
> To: dev@netbeans.apache.org
> Subject: Re: JPA Controller Generation
>
> Thanks Ken, for sending the PDF to me directly.  I agree that if these
> issues can be added to GitHub separately then it may be best.  I am
> surprised that the JIRA will not allow a PDF to be uploaded though?  I
> still think that it may be a good idea to try and attach the PDF to those
> issues somehow (dropbox link, etc.), just so your examples are included
> with the issues.
>
> Josh Juneau
> juneau001@gmail.com
> http://jj-blogger.blogspot.com
> https://www.apress.com/us/search?query=Juneau
>
> > On Feb 17, 2020, at 8:58 AM, Geertjan Wielenga <ge...@apache.org>
> wrote:
> >
> > Best is to begin by trying to identify the code in Apache NetBeans
> > GitHub that you would like to have changed. Then file an issue about
> > that code and about how it should be different code.
> >
> > Gj
> >
> >> On Mon, 17 Feb 2020 at 15:54, Kenneth Fogel
> >> <kf...@dawsoncollege.qc.ca>
> >> wrote:
> >>
> >> The three issues are tied together and that is why I created a
> >> document. I will turn them into three submissions to Jira but there
> >> are code examples in the doc. Is it appropriate to include a link to
> >> them from my OneDrive, Google Drive, or DropBox?
> >>
> >> Ken
> >>
> >>
> >> -----Original Message-----
> >> From: Geertjan Wielenga <ge...@apache.org>
> >> Sent: February 17, 2020 3:17 AM
> >> To: dev@netbeans.apache.org
> >> Subject: Re: JPA Controller Generation
> >>
> >> Indeed. Forget the document and just create an issue for each item
> >> separately.
> >>
> >> Ideally at least find the files in GitHub that need to be worked on
> >> to fix the issues.
> >>
> >> Gj
> >>
> >>> On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com>
> wrote:
> >>>
> >>> Hi
> >>>
> >>> Might be more worthwhile to allow others to look at the issues your
> >>> facing if you have multiple issues in a single word document to
> >>> break them up and create a single Jira ticket for each issue. Then
> >>> you don't need to upload a word document you can break that out and
> >>> put each issue description into Jira.
> >>>
> >>>
> >>> Regards
> >>>
> >>> John
> >>>
> >>> On Mon, 17 Feb 2020, 01:52 Kenneth Fogel,
> >>> <kf...@dawsoncollege.qc.ca>
> >>> wrote:
> >>>
> >>>> JIRA refused to accept my upload of a document that outlines my
> >>>> issues concerning the JPA generator. The file is available as a PDF
> >>>> or a Word docx. Both are refused with a message about a missing
> >>>> token. I do have a JIRA login. I will email it directly to you but
> >>>> I'd like to have it recorded on JIRA.
> >>>>
> >>>> Ken
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Josh Juneau <ju...@gmail.com>
> >>>> Sent: February 14, 2020 12:27 PM
> >>>> To: dev <de...@netbeans.apache.org>
> >>>> Subject: Re: JPA Controller Generation
> >>>>
> >>>> Thanks for reporting this issue Ken.  It would be good to get
> >>>> something
> >>> in
> >>>> the issue tracker for this problem.  I haven't used the
> >>>> auto-generation
> >>> of
> >>>> new JPA controllers.  I usually create my own so I haven't come
> >>>> across
> >>> this
> >>>> issue...but I'll see if I can replicate this problem.  I may not
> >>> personally
> >>>> be able to make the repairs for this (at least not anytime soon),
> >>>> but it should at least get in the tracker so that we can have it in
> >> the queue.
> >>> It
> >>>> does sound like this code needs updating.
> >>>>
> >>>> It sounds like you have a good strategy for moving forward with
> >>>> your class.  Hope all goes well.
> >>>>
> >>>> Thanks
> >>>>
> >>>> Josh Juneau
> >>>> juneau001@gmail.com
> >>>> http://jj-blogger.blogspot.com
> >>>> https://www.apress.com/us/search?query=Juneau
> >>>> <https://www.apress.com/index.php/author/author/view/id/1866>
> >>>>
> >>>>
> >>>>
> >>>> On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
> >>> kfogel@dawsoncollege.qc.ca>
> >>>> wrote:
> >>>>
> >>>>> I have calmed down and wish to apologize for the harshness of my
> >>>>> comments last night. I will download the latest source and review
> >>>>> the code that generates the controllers et all. I will suggest
> >>>>> that there should be two choices for JPA Controllers, one for
> >>>>> stand alone and one for application server managed.
> >>>>>
> >>>>> Ken
> >>>>>
> >>>>> ________________________________
> >>>>> From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> >>>>> Sent: Friday, February 14, 2020 12:51:59 AM
> >>>>> To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> >>>>> Subject: JPA Controller Generation
> >>>>>
> >>>>> I have been using NetBeans, as many of you know, for years. In the
> >>>>> winter I teach an EE course that uses the JPA. In using the New ->
> >>>>> JPA Controllers from Entities I couldn’t believe what came out.
> >>>>> Let’s
> >>> review
> >>>> two changes:
> >>>>>
> >>>>> If the persistence.xml file does not declare a connection (url,
> >>>>> user,
> >>>>> pwd) the generated controllers are empty. When this file is used
> >>>>> for EE JPA you declare the connection in glassfish-resources.xml
> >>>>> and not the persistence.xml. Previous versions of NB did show the
> >>>>> connection details but if I edited for EE JPA and then generated
> >>>>> the controllers they were still generated. The controllers are
> >>>>> generated from the entities so why is the generator even looking
> >>>>> at
> >> persistence.xml.
> >>>>>
> >>>>> Then there are the controllers themselves. They have been
> >>>>> optimized for stand alone, resource local usage. The
> >>>>> optimizations, especially the use of finally clauses to eliminate
> >>>>> catch clauses makes no sense to me. Many but not all exceptions
> >> simply result in an em.close().
> >>>>> This is effectively the same as having an empty catch clause.
> >>>>> Plus, with an injected  EntityManager you should not be closing
> >>>>> it, if I understand how CDI works. There is no rollback anywhere.
> >>>>> If the JPA now rolls back automatically when an exception occurs
> >>>>> I’ll withdraw
> >>> this
> >>>> complaint but I doubt it does.
> >>>>>
> >>>>> I could go on. If you want to see what controllers used to look
> >>>>> like and what had to be changed for EE look at my blog
> >>>>> https://www.omniprogrammer.com/?p=383.
> >>>>>
> >>>>> Is the JPA used more extensively on the desktop? I don’t think so.
> >>>>> Here I take the blame for not pointing out that there needs to be
> >>>>> JPA generation for Application Servers. If you look at my blog you
> >>>>> can see that the changes were minimal to the old generated code.
> >>>>> Now the changes will need to be more extensive.
> >>>>>
> >>>>> I have to stop now because I’m angry. Tomorrow morning I have to
> >>>>> face a class and before that I need to decide if I should tell
> >>>>> them to cut and paste code from my samples and change the names of
> >>>>> objects or show them all the changes needed to make the generated
> >> code work.
> >>>>>
> >>>>> Please tell me I have it all wrong and I’ll be happy to apologize
> >>>>> for this missive and never darken this mailing list again. I will
> >>>>> also be happy to contribute JPA/EE controller templates if my
> >>>>> concerns are
> >>> valid.
> >>>>>
> >>>>> Ken
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> >> For additional commands, e-mail: dev-help@netbeans.apache.org
> >>
> >> For further information about the NetBeans mailing lists, visit:
> >> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> >>
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

RE: JPA Controller Generation

Posted by Kenneth Fogel <kf...@dawsoncollege.qc.ca>.
Done. I have filed three issues on JIRA. I placed the pdf on github and put the url to the document into the description. When I have some time I will look at the source code as Geertjan suggested.

Ken

-----Original Message-----
From: Josh Juneau <ju...@gmail.com> 
Sent: February 17, 2020 10:01 AM
To: dev@netbeans.apache.org
Subject: Re: JPA Controller Generation

Thanks Ken, for sending the PDF to me directly.  I agree that if these issues can be added to GitHub separately then it may be best.  I am surprised that the JIRA will not allow a PDF to be uploaded though?  I still think that it may be a good idea to try and attach the PDF to those issues somehow (dropbox link, etc.), just so your examples are included with the issues.

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/us/search?query=Juneau

> On Feb 17, 2020, at 8:58 AM, Geertjan Wielenga <ge...@apache.org> wrote:
> 
> Best is to begin by trying to identify the code in Apache NetBeans 
> GitHub that you would like to have changed. Then file an issue about 
> that code and about how it should be different code.
> 
> Gj
> 
>> On Mon, 17 Feb 2020 at 15:54, Kenneth Fogel 
>> <kf...@dawsoncollege.qc.ca>
>> wrote:
>> 
>> The three issues are tied together and that is why I created a 
>> document. I will turn them into three submissions to Jira but there 
>> are code examples in the doc. Is it appropriate to include a link to 
>> them from my OneDrive, Google Drive, or DropBox?
>> 
>> Ken
>> 
>> 
>> -----Original Message-----
>> From: Geertjan Wielenga <ge...@apache.org>
>> Sent: February 17, 2020 3:17 AM
>> To: dev@netbeans.apache.org
>> Subject: Re: JPA Controller Generation
>> 
>> Indeed. Forget the document and just create an issue for each item 
>> separately.
>> 
>> Ideally at least find the files in GitHub that need to be worked on 
>> to fix the issues.
>> 
>> Gj
>> 
>>> On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com> wrote:
>>> 
>>> Hi
>>> 
>>> Might be more worthwhile to allow others to look at the issues your 
>>> facing if you have multiple issues in a single word document to 
>>> break them up and create a single Jira ticket for each issue. Then 
>>> you don't need to upload a word document you can break that out and 
>>> put each issue description into Jira.
>>> 
>>> 
>>> Regards
>>> 
>>> John
>>> 
>>> On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, 
>>> <kf...@dawsoncollege.qc.ca>
>>> wrote:
>>> 
>>>> JIRA refused to accept my upload of a document that outlines my 
>>>> issues concerning the JPA generator. The file is available as a PDF 
>>>> or a Word docx. Both are refused with a message about a missing 
>>>> token. I do have a JIRA login. I will email it directly to you but 
>>>> I'd like to have it recorded on JIRA.
>>>> 
>>>> Ken
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Josh Juneau <ju...@gmail.com>
>>>> Sent: February 14, 2020 12:27 PM
>>>> To: dev <de...@netbeans.apache.org>
>>>> Subject: Re: JPA Controller Generation
>>>> 
>>>> Thanks for reporting this issue Ken.  It would be good to get 
>>>> something
>>> in
>>>> the issue tracker for this problem.  I haven't used the 
>>>> auto-generation
>>> of
>>>> new JPA controllers.  I usually create my own so I haven't come 
>>>> across
>>> this
>>>> issue...but I'll see if I can replicate this problem.  I may not
>>> personally
>>>> be able to make the repairs for this (at least not anytime soon), 
>>>> but it should at least get in the tracker so that we can have it in
>> the queue.
>>> It
>>>> does sound like this code needs updating.
>>>> 
>>>> It sounds like you have a good strategy for moving forward with 
>>>> your class.  Hope all goes well.
>>>> 
>>>> Thanks
>>>> 
>>>> Josh Juneau
>>>> juneau001@gmail.com
>>>> http://jj-blogger.blogspot.com
>>>> https://www.apress.com/us/search?query=Juneau
>>>> <https://www.apress.com/index.php/author/author/view/id/1866>
>>>> 
>>>> 
>>>> 
>>>> On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
>>> kfogel@dawsoncollege.qc.ca>
>>>> wrote:
>>>> 
>>>>> I have calmed down and wish to apologize for the harshness of my 
>>>>> comments last night. I will download the latest source and review 
>>>>> the code that generates the controllers et all. I will suggest 
>>>>> that there should be two choices for JPA Controllers, one for 
>>>>> stand alone and one for application server managed.
>>>>> 
>>>>> Ken
>>>>> 
>>>>> ________________________________
>>>>> From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
>>>>> Sent: Friday, February 14, 2020 12:51:59 AM
>>>>> To: dev@netbeans.apache.org <de...@netbeans.apache.org>
>>>>> Subject: JPA Controller Generation
>>>>> 
>>>>> I have been using NetBeans, as many of you know, for years. In the 
>>>>> winter I teach an EE course that uses the JPA. In using the New -> 
>>>>> JPA Controllers from Entities I couldn’t believe what came out.
>>>>> Let’s
>>> review
>>>> two changes:
>>>>> 
>>>>> If the persistence.xml file does not declare a connection (url, 
>>>>> user,
>>>>> pwd) the generated controllers are empty. When this file is used 
>>>>> for EE JPA you declare the connection in glassfish-resources.xml 
>>>>> and not the persistence.xml. Previous versions of NB did show the 
>>>>> connection details but if I edited for EE JPA and then generated 
>>>>> the controllers they were still generated. The controllers are 
>>>>> generated from the entities so why is the generator even looking 
>>>>> at
>> persistence.xml.
>>>>> 
>>>>> Then there are the controllers themselves. They have been 
>>>>> optimized for stand alone, resource local usage. The 
>>>>> optimizations, especially the use of finally clauses to eliminate 
>>>>> catch clauses makes no sense to me. Many but not all exceptions
>> simply result in an em.close().
>>>>> This is effectively the same as having an empty catch clause.
>>>>> Plus, with an injected  EntityManager you should not be closing 
>>>>> it, if I understand how CDI works. There is no rollback anywhere.
>>>>> If the JPA now rolls back automatically when an exception occurs 
>>>>> I’ll withdraw
>>> this
>>>> complaint but I doubt it does.
>>>>> 
>>>>> I could go on. If you want to see what controllers used to look 
>>>>> like and what had to be changed for EE look at my blog 
>>>>> https://www.omniprogrammer.com/?p=383.
>>>>> 
>>>>> Is the JPA used more extensively on the desktop? I don’t think so.
>>>>> Here I take the blame for not pointing out that there needs to be 
>>>>> JPA generation for Application Servers. If you look at my blog you 
>>>>> can see that the changes were minimal to the old generated code.
>>>>> Now the changes will need to be more extensive.
>>>>> 
>>>>> I have to stop now because I’m angry. Tomorrow morning I have to 
>>>>> face a class and before that I need to decide if I should tell 
>>>>> them to cut and paste code from my samples and change the names of 
>>>>> objects or show them all the changes needed to make the generated
>> code work.
>>>>> 
>>>>> Please tell me I have it all wrong and I’ll be happy to apologize 
>>>>> for this missive and never darken this mailing list again. I will 
>>>>> also be happy to contribute JPA/EE controller templates if my 
>>>>> concerns are
>>> valid.
>>>>> 
>>>>> Ken
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: dev-help@netbeans.apache.org
>> 
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>> 
>> 
>> 
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: JPA Controller Generation

Posted by Josh Juneau <ju...@gmail.com>.
Thanks Ken, for sending the PDF to me directly.  I agree that if these issues can be added to GitHub separately then it may be best.  I am surprised that the JIRA will not allow a PDF to be uploaded though?  I still think that it may be a good idea to try and attach the PDF to those issues somehow (dropbox link, etc.), just so your examples are included with the issues.

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/us/search?query=Juneau

> On Feb 17, 2020, at 8:58 AM, Geertjan Wielenga <ge...@apache.org> wrote:
> 
> Best is to begin by trying to identify the code in Apache NetBeans GitHub
> that you would like to have changed. Then file an issue about that code and
> about how it should be different code.
> 
> Gj
> 
>> On Mon, 17 Feb 2020 at 15:54, Kenneth Fogel <kf...@dawsoncollege.qc.ca>
>> wrote:
>> 
>> The three issues are tied together and that is why I created a document. I
>> will turn them into three submissions to Jira but there are code examples
>> in the doc. Is it appropriate to include a link to them from my OneDrive,
>> Google Drive, or DropBox?
>> 
>> Ken
>> 
>> 
>> -----Original Message-----
>> From: Geertjan Wielenga <ge...@apache.org>
>> Sent: February 17, 2020 3:17 AM
>> To: dev@netbeans.apache.org
>> Subject: Re: JPA Controller Generation
>> 
>> Indeed. Forget the document and just create an issue for each item
>> separately.
>> 
>> Ideally at least find the files in GitHub that need to be worked on to fix
>> the issues.
>> 
>> Gj
>> 
>>> On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com> wrote:
>>> 
>>> Hi
>>> 
>>> Might be more worthwhile to allow others to look at the issues your
>>> facing if you have multiple issues in a single word document to break
>>> them up and create a single Jira ticket for each issue. Then you don't
>>> need to upload a word document you can break that out and put each
>>> issue description into Jira.
>>> 
>>> 
>>> Regards
>>> 
>>> John
>>> 
>>> On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, <kf...@dawsoncollege.qc.ca>
>>> wrote:
>>> 
>>>> JIRA refused to accept my upload of a document that outlines my
>>>> issues concerning the JPA generator. The file is available as a PDF
>>>> or a Word docx. Both are refused with a message about a missing
>>>> token. I do have a JIRA login. I will email it directly to you but
>>>> I'd like to have it recorded on JIRA.
>>>> 
>>>> Ken
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Josh Juneau <ju...@gmail.com>
>>>> Sent: February 14, 2020 12:27 PM
>>>> To: dev <de...@netbeans.apache.org>
>>>> Subject: Re: JPA Controller Generation
>>>> 
>>>> Thanks for reporting this issue Ken.  It would be good to get
>>>> something
>>> in
>>>> the issue tracker for this problem.  I haven't used the
>>>> auto-generation
>>> of
>>>> new JPA controllers.  I usually create my own so I haven't come
>>>> across
>>> this
>>>> issue...but I'll see if I can replicate this problem.  I may not
>>> personally
>>>> be able to make the repairs for this (at least not anytime soon),
>>>> but it should at least get in the tracker so that we can have it in
>> the queue.
>>> It
>>>> does sound like this code needs updating.
>>>> 
>>>> It sounds like you have a good strategy for moving forward with your
>>>> class.  Hope all goes well.
>>>> 
>>>> Thanks
>>>> 
>>>> Josh Juneau
>>>> juneau001@gmail.com
>>>> http://jj-blogger.blogspot.com
>>>> https://www.apress.com/us/search?query=Juneau
>>>> <https://www.apress.com/index.php/author/author/view/id/1866>
>>>> 
>>>> 
>>>> 
>>>> On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
>>> kfogel@dawsoncollege.qc.ca>
>>>> wrote:
>>>> 
>>>>> I have calmed down and wish to apologize for the harshness of my
>>>>> comments last night. I will download the latest source and review
>>>>> the code that generates the controllers et all. I will suggest
>>>>> that there should be two choices for JPA Controllers, one for
>>>>> stand alone and one for application server managed.
>>>>> 
>>>>> Ken
>>>>> 
>>>>> ________________________________
>>>>> From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
>>>>> Sent: Friday, February 14, 2020 12:51:59 AM
>>>>> To: dev@netbeans.apache.org <de...@netbeans.apache.org>
>>>>> Subject: JPA Controller Generation
>>>>> 
>>>>> I have been using NetBeans, as many of you know, for years. In the
>>>>> winter I teach an EE course that uses the JPA. In using the New ->
>>>>> JPA Controllers from Entities I couldn’t believe what came out.
>>>>> Let’s
>>> review
>>>> two changes:
>>>>> 
>>>>> If the persistence.xml file does not declare a connection (url,
>>>>> user,
>>>>> pwd) the generated controllers are empty. When this file is used
>>>>> for EE JPA you declare the connection in glassfish-resources.xml
>>>>> and not the persistence.xml. Previous versions of NB did show the
>>>>> connection details but if I edited for EE JPA and then generated
>>>>> the controllers they were still generated. The controllers are
>>>>> generated from the entities so why is the generator even looking at
>> persistence.xml.
>>>>> 
>>>>> Then there are the controllers themselves. They have been
>>>>> optimized for stand alone, resource local usage. The
>>>>> optimizations, especially the use of finally clauses to eliminate
>>>>> catch clauses makes no sense to me. Many but not all exceptions
>> simply result in an em.close().
>>>>> This is effectively the same as having an empty catch clause.
>>>>> Plus, with an injected  EntityManager you should not be closing
>>>>> it, if I understand how CDI works. There is no rollback anywhere.
>>>>> If the JPA now rolls back automatically when an exception occurs
>>>>> I’ll withdraw
>>> this
>>>> complaint but I doubt it does.
>>>>> 
>>>>> I could go on. If you want to see what controllers used to look
>>>>> like and what had to be changed for EE look at my blog
>>>>> https://www.omniprogrammer.com/?p=383.
>>>>> 
>>>>> Is the JPA used more extensively on the desktop? I don’t think so.
>>>>> Here I take the blame for not pointing out that there needs to be
>>>>> JPA generation for Application Servers. If you look at my blog you
>>>>> can see that the changes were minimal to the old generated code.
>>>>> Now the changes will need to be more extensive.
>>>>> 
>>>>> I have to stop now because I’m angry. Tomorrow morning I have to
>>>>> face a class and before that I need to decide if I should tell
>>>>> them to cut and paste code from my samples and change the names of
>>>>> objects or show them all the changes needed to make the generated
>> code work.
>>>>> 
>>>>> Please tell me I have it all wrong and I’ll be happy to apologize
>>>>> for this missive and never darken this mailing list again. I will
>>>>> also be happy to contribute JPA/EE controller templates if my
>>>>> concerns are
>>> valid.
>>>>> 
>>>>> Ken
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: dev-help@netbeans.apache.org
>> 
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>> 
>> 
>> 
>> 

Re: JPA Controller Generation

Posted by Geertjan Wielenga <ge...@apache.org>.
Best is to begin by trying to identify the code in Apache NetBeans GitHub
that you would like to have changed. Then file an issue about that code and
about how it should be different code.

Gj

On Mon, 17 Feb 2020 at 15:54, Kenneth Fogel <kf...@dawsoncollege.qc.ca>
wrote:

> The three issues are tied together and that is why I created a document. I
> will turn them into three submissions to Jira but there are code examples
> in the doc. Is it appropriate to include a link to them from my OneDrive,
> Google Drive, or DropBox?
>
> Ken
>
>
> -----Original Message-----
> From: Geertjan Wielenga <ge...@apache.org>
> Sent: February 17, 2020 3:17 AM
> To: dev@netbeans.apache.org
> Subject: Re: JPA Controller Generation
>
> Indeed. Forget the document and just create an issue for each item
> separately.
>
> Ideally at least find the files in GitHub that need to be worked on to fix
> the issues.
>
> Gj
>
> On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com> wrote:
>
> > Hi
> >
> > Might be more worthwhile to allow others to look at the issues your
> > facing if you have multiple issues in a single word document to break
> > them up and create a single Jira ticket for each issue. Then you don't
> > need to upload a word document you can break that out and put each
> > issue description into Jira.
> >
> >
> > Regards
> >
> > John
> >
> > On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, <kf...@dawsoncollege.qc.ca>
> > wrote:
> >
> > > JIRA refused to accept my upload of a document that outlines my
> > > issues concerning the JPA generator. The file is available as a PDF
> > > or a Word docx. Both are refused with a message about a missing
> > > token. I do have a JIRA login. I will email it directly to you but
> > > I'd like to have it recorded on JIRA.
> > >
> > > Ken
> > >
> > >
> > > -----Original Message-----
> > > From: Josh Juneau <ju...@gmail.com>
> > > Sent: February 14, 2020 12:27 PM
> > > To: dev <de...@netbeans.apache.org>
> > > Subject: Re: JPA Controller Generation
> > >
> > > Thanks for reporting this issue Ken.  It would be good to get
> > > something
> > in
> > > the issue tracker for this problem.  I haven't used the
> > > auto-generation
> > of
> > > new JPA controllers.  I usually create my own so I haven't come
> > > across
> > this
> > > issue...but I'll see if I can replicate this problem.  I may not
> > personally
> > > be able to make the repairs for this (at least not anytime soon),
> > > but it should at least get in the tracker so that we can have it in
> the queue.
> > It
> > > does sound like this code needs updating.
> > >
> > > It sounds like you have a good strategy for moving forward with your
> > > class.  Hope all goes well.
> > >
> > > Thanks
> > >
> > > Josh Juneau
> > > juneau001@gmail.com
> > > http://jj-blogger.blogspot.com
> > > https://www.apress.com/us/search?query=Juneau
> > > <https://www.apress.com/index.php/author/author/view/id/1866>
> > >
> > >
> > >
> > > On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
> > kfogel@dawsoncollege.qc.ca>
> > > wrote:
> > >
> > > > I have calmed down and wish to apologize for the harshness of my
> > > > comments last night. I will download the latest source and review
> > > > the code that generates the controllers et all. I will suggest
> > > > that there should be two choices for JPA Controllers, one for
> > > > stand alone and one for application server managed.
> > > >
> > > > Ken
> > > >
> > > > ________________________________
> > > > From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> > > > Sent: Friday, February 14, 2020 12:51:59 AM
> > > > To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> > > > Subject: JPA Controller Generation
> > > >
> > > > I have been using NetBeans, as many of you know, for years. In the
> > > > winter I teach an EE course that uses the JPA. In using the New ->
> > > > JPA Controllers from Entities I couldn’t believe what came out.
> > > > Let’s
> > review
> > > two changes:
> > > >
> > > > If the persistence.xml file does not declare a connection (url,
> > > > user,
> > > > pwd) the generated controllers are empty. When this file is used
> > > > for EE JPA you declare the connection in glassfish-resources.xml
> > > > and not the persistence.xml. Previous versions of NB did show the
> > > > connection details but if I edited for EE JPA and then generated
> > > > the controllers they were still generated. The controllers are
> > > > generated from the entities so why is the generator even looking at
> persistence.xml.
> > > >
> > > > Then there are the controllers themselves. They have been
> > > > optimized for stand alone, resource local usage. The
> > > > optimizations, especially the use of finally clauses to eliminate
> > > > catch clauses makes no sense to me. Many but not all exceptions
> simply result in an em.close().
> > > > This is effectively the same as having an empty catch clause.
> > > > Plus, with an injected  EntityManager you should not be closing
> > > > it, if I understand how CDI works. There is no rollback anywhere.
> > > > If the JPA now rolls back automatically when an exception occurs
> > > > I’ll withdraw
> > this
> > > complaint but I doubt it does.
> > > >
> > > > I could go on. If you want to see what controllers used to look
> > > > like and what had to be changed for EE look at my blog
> > > > https://www.omniprogrammer.com/?p=383.
> > > >
> > > > Is the JPA used more extensively on the desktop? I don’t think so.
> > > > Here I take the blame for not pointing out that there needs to be
> > > > JPA generation for Application Servers. If you look at my blog you
> > > > can see that the changes were minimal to the old generated code.
> > > > Now the changes will need to be more extensive.
> > > >
> > > > I have to stop now because I’m angry. Tomorrow morning I have to
> > > > face a class and before that I need to decide if I should tell
> > > > them to cut and paste code from my samples and change the names of
> > > > objects or show them all the changes needed to make the generated
> code work.
> > > >
> > > > Please tell me I have it all wrong and I’ll be happy to apologize
> > > > for this missive and never darken this mailing list again. I will
> > > > also be happy to contribute JPA/EE controller templates if my
> > > > concerns are
> > valid.
> > > >
> > > > Ken
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>

RE: JPA Controller Generation

Posted by Kenneth Fogel <kf...@dawsoncollege.qc.ca>.
The three issues are tied together and that is why I created a document. I will turn them into three submissions to Jira but there are code examples in the doc. Is it appropriate to include a link to them from my OneDrive, Google Drive, or DropBox?

Ken


-----Original Message-----
From: Geertjan Wielenga <ge...@apache.org> 
Sent: February 17, 2020 3:17 AM
To: dev@netbeans.apache.org
Subject: Re: JPA Controller Generation

Indeed. Forget the document and just create an issue for each item separately.

Ideally at least find the files in GitHub that need to be worked on to fix the issues.

Gj

On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com> wrote:

> Hi
>
> Might be more worthwhile to allow others to look at the issues your 
> facing if you have multiple issues in a single word document to break 
> them up and create a single Jira ticket for each issue. Then you don't 
> need to upload a word document you can break that out and put each 
> issue description into Jira.
>
>
> Regards
>
> John
>
> On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, <kf...@dawsoncollege.qc.ca>
> wrote:
>
> > JIRA refused to accept my upload of a document that outlines my 
> > issues concerning the JPA generator. The file is available as a PDF 
> > or a Word docx. Both are refused with a message about a missing 
> > token. I do have a JIRA login. I will email it directly to you but 
> > I'd like to have it recorded on JIRA.
> >
> > Ken
> >
> >
> > -----Original Message-----
> > From: Josh Juneau <ju...@gmail.com>
> > Sent: February 14, 2020 12:27 PM
> > To: dev <de...@netbeans.apache.org>
> > Subject: Re: JPA Controller Generation
> >
> > Thanks for reporting this issue Ken.  It would be good to get 
> > something
> in
> > the issue tracker for this problem.  I haven't used the 
> > auto-generation
> of
> > new JPA controllers.  I usually create my own so I haven't come 
> > across
> this
> > issue...but I'll see if I can replicate this problem.  I may not
> personally
> > be able to make the repairs for this (at least not anytime soon), 
> > but it should at least get in the tracker so that we can have it in the queue.
> It
> > does sound like this code needs updating.
> >
> > It sounds like you have a good strategy for moving forward with your 
> > class.  Hope all goes well.
> >
> > Thanks
> >
> > Josh Juneau
> > juneau001@gmail.com
> > http://jj-blogger.blogspot.com
> > https://www.apress.com/us/search?query=Juneau
> > <https://www.apress.com/index.php/author/author/view/id/1866>
> >
> >
> >
> > On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
> kfogel@dawsoncollege.qc.ca>
> > wrote:
> >
> > > I have calmed down and wish to apologize for the harshness of my 
> > > comments last night. I will download the latest source and review 
> > > the code that generates the controllers et all. I will suggest 
> > > that there should be two choices for JPA Controllers, one for 
> > > stand alone and one for application server managed.
> > >
> > > Ken
> > >
> > > ________________________________
> > > From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> > > Sent: Friday, February 14, 2020 12:51:59 AM
> > > To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> > > Subject: JPA Controller Generation
> > >
> > > I have been using NetBeans, as many of you know, for years. In the 
> > > winter I teach an EE course that uses the JPA. In using the New -> 
> > > JPA Controllers from Entities I couldn’t believe what came out. 
> > > Let’s
> review
> > two changes:
> > >
> > > If the persistence.xml file does not declare a connection (url, 
> > > user,
> > > pwd) the generated controllers are empty. When this file is used 
> > > for EE JPA you declare the connection in glassfish-resources.xml 
> > > and not the persistence.xml. Previous versions of NB did show the 
> > > connection details but if I edited for EE JPA and then generated 
> > > the controllers they were still generated. The controllers are 
> > > generated from the entities so why is the generator even looking at persistence.xml.
> > >
> > > Then there are the controllers themselves. They have been 
> > > optimized for stand alone, resource local usage. The 
> > > optimizations, especially the use of finally clauses to eliminate 
> > > catch clauses makes no sense to me. Many but not all exceptions simply result in an em.close().
> > > This is effectively the same as having an empty catch clause. 
> > > Plus, with an injected  EntityManager you should not be closing 
> > > it, if I understand how CDI works. There is no rollback anywhere. 
> > > If the JPA now rolls back automatically when an exception occurs 
> > > I’ll withdraw
> this
> > complaint but I doubt it does.
> > >
> > > I could go on. If you want to see what controllers used to look 
> > > like and what had to be changed for EE look at my blog 
> > > https://www.omniprogrammer.com/?p=383.
> > >
> > > Is the JPA used more extensively on the desktop? I don’t think so.
> > > Here I take the blame for not pointing out that there needs to be 
> > > JPA generation for Application Servers. If you look at my blog you 
> > > can see that the changes were minimal to the old generated code. 
> > > Now the changes will need to be more extensive.
> > >
> > > I have to stop now because I’m angry. Tomorrow morning I have to 
> > > face a class and before that I need to decide if I should tell 
> > > them to cut and paste code from my samples and change the names of 
> > > objects or show them all the changes needed to make the generated code work.
> > >
> > > Please tell me I have it all wrong and I’ll be happy to apologize 
> > > for this missive and never darken this mailing list again. I will 
> > > also be happy to contribute JPA/EE controller templates if my 
> > > concerns are
> valid.
> > >
> > > Ken
> > >
> > >
> > >
> > >
> > >
> > >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: JPA Controller Generation

Posted by Geertjan Wielenga <ge...@apache.org>.
Indeed. Forget the document and just create an issue for each item
separately.

Ideally at least find the files in GitHub that need to be worked on to fix
the issues.

Gj

On Mon, 17 Feb 2020 at 09:14, John Mc <mc...@gmail.com> wrote:

> Hi
>
> Might be more worthwhile to allow others to look at the issues your facing
> if you have multiple issues in a single word document to break them up and
> create a single Jira ticket for each issue. Then you don't need to upload a
> word document you can break that out and put each issue description into
> Jira.
>
>
> Regards
>
> John
>
> On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, <kf...@dawsoncollege.qc.ca>
> wrote:
>
> > JIRA refused to accept my upload of a document that outlines my issues
> > concerning the JPA generator. The file is available as a PDF or a Word
> > docx. Both are refused with a message about a missing token. I do have a
> > JIRA login. I will email it directly to you but I'd like to have it
> > recorded on JIRA.
> >
> > Ken
> >
> >
> > -----Original Message-----
> > From: Josh Juneau <ju...@gmail.com>
> > Sent: February 14, 2020 12:27 PM
> > To: dev <de...@netbeans.apache.org>
> > Subject: Re: JPA Controller Generation
> >
> > Thanks for reporting this issue Ken.  It would be good to get something
> in
> > the issue tracker for this problem.  I haven't used the auto-generation
> of
> > new JPA controllers.  I usually create my own so I haven't come across
> this
> > issue...but I'll see if I can replicate this problem.  I may not
> personally
> > be able to make the repairs for this (at least not anytime soon), but it
> > should at least get in the tracker so that we can have it in the queue.
> It
> > does sound like this code needs updating.
> >
> > It sounds like you have a good strategy for moving forward with your
> > class.  Hope all goes well.
> >
> > Thanks
> >
> > Josh Juneau
> > juneau001@gmail.com
> > http://jj-blogger.blogspot.com
> > https://www.apress.com/us/search?query=Juneau
> > <https://www.apress.com/index.php/author/author/view/id/1866>
> >
> >
> >
> > On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <
> kfogel@dawsoncollege.qc.ca>
> > wrote:
> >
> > > I have calmed down and wish to apologize for the harshness of my
> > > comments last night. I will download the latest source and review the
> > > code that generates the controllers et all. I will suggest that there
> > > should be two choices for JPA Controllers, one for stand alone and one
> > > for application server managed.
> > >
> > > Ken
> > >
> > > ________________________________
> > > From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> > > Sent: Friday, February 14, 2020 12:51:59 AM
> > > To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> > > Subject: JPA Controller Generation
> > >
> > > I have been using NetBeans, as many of you know, for years. In the
> > > winter I teach an EE course that uses the JPA. In using the New -> JPA
> > > Controllers from Entities I couldn’t believe what came out. Let’s
> review
> > two changes:
> > >
> > > If the persistence.xml file does not declare a connection (url, user,
> > > pwd) the generated controllers are empty. When this file is used for
> > > EE JPA you declare the connection in glassfish-resources.xml and not
> > > the persistence.xml. Previous versions of NB did show the connection
> > > details but if I edited for EE JPA and then generated the controllers
> > > they were still generated. The controllers are generated from the
> > > entities so why is the generator even looking at persistence.xml.
> > >
> > > Then there are the controllers themselves. They have been optimized
> > > for stand alone, resource local usage. The optimizations, especially
> > > the use of finally clauses to eliminate catch clauses makes no sense
> > > to me. Many but not all exceptions simply result in an em.close().
> > > This is effectively the same as having an empty catch clause. Plus,
> > > with an injected  EntityManager you should not be closing it, if I
> > > understand how CDI works. There is no rollback anywhere. If the JPA
> > > now rolls back automatically when an exception occurs I’ll withdraw
> this
> > complaint but I doubt it does.
> > >
> > > I could go on. If you want to see what controllers used to look like
> > > and what had to be changed for EE look at my blog
> > > https://www.omniprogrammer.com/?p=383.
> > >
> > > Is the JPA used more extensively on the desktop? I don’t think so.
> > > Here I take the blame for not pointing out that there needs to be JPA
> > > generation for Application Servers. If you look at my blog you can see
> > > that the changes were minimal to the old generated code. Now the
> > > changes will need to be more extensive.
> > >
> > > I have to stop now because I’m angry. Tomorrow morning I have to face
> > > a class and before that I need to decide if I should tell them to cut
> > > and paste code from my samples and change the names of objects or show
> > > them all the changes needed to make the generated code work.
> > >
> > > Please tell me I have it all wrong and I’ll be happy to apologize for
> > > this missive and never darken this mailing list again. I will also be
> > > happy to contribute JPA/EE controller templates if my concerns are
> valid.
> > >
> > > Ken
> > >
> > >
> > >
> > >
> > >
> > >
> >
>

Re: JPA Controller Generation

Posted by John Mc <mc...@gmail.com>.
Hi

Might be more worthwhile to allow others to look at the issues your facing
if you have multiple issues in a single word document to break them up and
create a single Jira ticket for each issue. Then you don't need to upload a
word document you can break that out and put each issue description into
Jira.


Regards

John

On Mon, 17 Feb 2020, 01:52 Kenneth Fogel, <kf...@dawsoncollege.qc.ca>
wrote:

> JIRA refused to accept my upload of a document that outlines my issues
> concerning the JPA generator. The file is available as a PDF or a Word
> docx. Both are refused with a message about a missing token. I do have a
> JIRA login. I will email it directly to you but I'd like to have it
> recorded on JIRA.
>
> Ken
>
>
> -----Original Message-----
> From: Josh Juneau <ju...@gmail.com>
> Sent: February 14, 2020 12:27 PM
> To: dev <de...@netbeans.apache.org>
> Subject: Re: JPA Controller Generation
>
> Thanks for reporting this issue Ken.  It would be good to get something in
> the issue tracker for this problem.  I haven't used the auto-generation of
> new JPA controllers.  I usually create my own so I haven't come across this
> issue...but I'll see if I can replicate this problem.  I may not personally
> be able to make the repairs for this (at least not anytime soon), but it
> should at least get in the tracker so that we can have it in the queue.  It
> does sound like this code needs updating.
>
> It sounds like you have a good strategy for moving forward with your
> class.  Hope all goes well.
>
> Thanks
>
> Josh Juneau
> juneau001@gmail.com
> http://jj-blogger.blogspot.com
> https://www.apress.com/us/search?query=Juneau
> <https://www.apress.com/index.php/author/author/view/id/1866>
>
>
>
> On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> wrote:
>
> > I have calmed down and wish to apologize for the harshness of my
> > comments last night. I will download the latest source and review the
> > code that generates the controllers et all. I will suggest that there
> > should be two choices for JPA Controllers, one for stand alone and one
> > for application server managed.
> >
> > Ken
> >
> > ________________________________
> > From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> > Sent: Friday, February 14, 2020 12:51:59 AM
> > To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> > Subject: JPA Controller Generation
> >
> > I have been using NetBeans, as many of you know, for years. In the
> > winter I teach an EE course that uses the JPA. In using the New -> JPA
> > Controllers from Entities I couldn’t believe what came out. Let’s review
> two changes:
> >
> > If the persistence.xml file does not declare a connection (url, user,
> > pwd) the generated controllers are empty. When this file is used for
> > EE JPA you declare the connection in glassfish-resources.xml and not
> > the persistence.xml. Previous versions of NB did show the connection
> > details but if I edited for EE JPA and then generated the controllers
> > they were still generated. The controllers are generated from the
> > entities so why is the generator even looking at persistence.xml.
> >
> > Then there are the controllers themselves. They have been optimized
> > for stand alone, resource local usage. The optimizations, especially
> > the use of finally clauses to eliminate catch clauses makes no sense
> > to me. Many but not all exceptions simply result in an em.close().
> > This is effectively the same as having an empty catch clause. Plus,
> > with an injected  EntityManager you should not be closing it, if I
> > understand how CDI works. There is no rollback anywhere. If the JPA
> > now rolls back automatically when an exception occurs I’ll withdraw this
> complaint but I doubt it does.
> >
> > I could go on. If you want to see what controllers used to look like
> > and what had to be changed for EE look at my blog
> > https://www.omniprogrammer.com/?p=383.
> >
> > Is the JPA used more extensively on the desktop? I don’t think so.
> > Here I take the blame for not pointing out that there needs to be JPA
> > generation for Application Servers. If you look at my blog you can see
> > that the changes were minimal to the old generated code. Now the
> > changes will need to be more extensive.
> >
> > I have to stop now because I’m angry. Tomorrow morning I have to face
> > a class and before that I need to decide if I should tell them to cut
> > and paste code from my samples and change the names of objects or show
> > them all the changes needed to make the generated code work.
> >
> > Please tell me I have it all wrong and I’ll be happy to apologize for
> > this missive and never darken this mailing list again. I will also be
> > happy to contribute JPA/EE controller templates if my concerns are valid.
> >
> > Ken
> >
> >
> >
> >
> >
> >
>

RE: JPA Controller Generation

Posted by Kenneth Fogel <kf...@dawsoncollege.qc.ca>.
JIRA refused to accept my upload of a document that outlines my issues concerning the JPA generator. The file is available as a PDF or a Word docx. Both are refused with a message about a missing token. I do have a JIRA login. I will email it directly to you but I'd like to have it recorded on JIRA.

Ken


-----Original Message-----
From: Josh Juneau <ju...@gmail.com> 
Sent: February 14, 2020 12:27 PM
To: dev <de...@netbeans.apache.org>
Subject: Re: JPA Controller Generation

Thanks for reporting this issue Ken.  It would be good to get something in the issue tracker for this problem.  I haven't used the auto-generation of new JPA controllers.  I usually create my own so I haven't come across this issue...but I'll see if I can replicate this problem.  I may not personally be able to make the repairs for this (at least not anytime soon), but it should at least get in the tracker so that we can have it in the queue.  It does sound like this code needs updating.

It sounds like you have a good strategy for moving forward with your class.  Hope all goes well.

Thanks

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/us/search?query=Juneau
<https://www.apress.com/index.php/author/author/view/id/1866>



On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <kf...@dawsoncollege.qc.ca>
wrote:

> I have calmed down and wish to apologize for the harshness of my 
> comments last night. I will download the latest source and review the 
> code that generates the controllers et all. I will suggest that there 
> should be two choices for JPA Controllers, one for stand alone and one 
> for application server managed.
>
> Ken
>
> ________________________________
> From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> Sent: Friday, February 14, 2020 12:51:59 AM
> To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> Subject: JPA Controller Generation
>
> I have been using NetBeans, as many of you know, for years. In the 
> winter I teach an EE course that uses the JPA. In using the New -> JPA 
> Controllers from Entities I couldn’t believe what came out. Let’s review two changes:
>
> If the persistence.xml file does not declare a connection (url, user, 
> pwd) the generated controllers are empty. When this file is used for 
> EE JPA you declare the connection in glassfish-resources.xml and not 
> the persistence.xml. Previous versions of NB did show the connection 
> details but if I edited for EE JPA and then generated the controllers 
> they were still generated. The controllers are generated from the 
> entities so why is the generator even looking at persistence.xml.
>
> Then there are the controllers themselves. They have been optimized 
> for stand alone, resource local usage. The optimizations, especially 
> the use of finally clauses to eliminate catch clauses makes no sense 
> to me. Many but not all exceptions simply result in an em.close(). 
> This is effectively the same as having an empty catch clause. Plus, 
> with an injected  EntityManager you should not be closing it, if I 
> understand how CDI works. There is no rollback anywhere. If the JPA 
> now rolls back automatically when an exception occurs I’ll withdraw this complaint but I doubt it does.
>
> I could go on. If you want to see what controllers used to look like 
> and what had to be changed for EE look at my blog 
> https://www.omniprogrammer.com/?p=383.
>
> Is the JPA used more extensively on the desktop? I don’t think so. 
> Here I take the blame for not pointing out that there needs to be JPA 
> generation for Application Servers. If you look at my blog you can see 
> that the changes were minimal to the old generated code. Now the 
> changes will need to be more extensive.
>
> I have to stop now because I’m angry. Tomorrow morning I have to face 
> a class and before that I need to decide if I should tell them to cut 
> and paste code from my samples and change the names of objects or show 
> them all the changes needed to make the generated code work.
>
> Please tell me I have it all wrong and I’ll be happy to apologize for 
> this missive and never darken this mailing list again. I will also be 
> happy to contribute JPA/EE controller templates if my concerns are valid.
>
> Ken
>
>
>
>
>
>

Re: JPA Controller Generation

Posted by Josh Juneau <ju...@gmail.com>.
Thanks for reporting this issue Ken.  It would be good to get something in
the issue tracker for this problem.  I haven't used the auto-generation of
new JPA controllers.  I usually create my own so I haven't come across this
issue...but I'll see if I can replicate this problem.  I may not personally
be able to make the repairs for this (at least not anytime soon), but it
should at least get in the tracker so that we can have it in the queue.  It
does sound like this code needs updating.

It sounds like you have a good strategy for moving forward with your
class.  Hope all goes well.

Thanks

Josh Juneau
juneau001@gmail.com
http://jj-blogger.blogspot.com
https://www.apress.com/us/search?query=Juneau
<https://www.apress.com/index.php/author/author/view/id/1866>



On Fri, Feb 14, 2020 at 8:31 AM Kenneth Fogel <kf...@dawsoncollege.qc.ca>
wrote:

> I have calmed down and wish to apologize for the harshness of my comments
> last night. I will download the latest source and review the code that
> generates the controllers et all. I will suggest that there should be two
> choices for JPA Controllers, one for stand alone and one for application
> server managed.
>
> Ken
>
> ________________________________
> From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
> Sent: Friday, February 14, 2020 12:51:59 AM
> To: dev@netbeans.apache.org <de...@netbeans.apache.org>
> Subject: JPA Controller Generation
>
> I have been using NetBeans, as many of you know, for years. In the winter
> I teach an EE course that uses the JPA. In using the New -> JPA Controllers
> from Entities I couldn’t believe what came out. Let’s review two changes:
>
> If the persistence.xml file does not declare a connection (url, user, pwd)
> the generated controllers are empty. When this file is used for EE JPA you
> declare the connection in glassfish-resources.xml and not the
> persistence.xml. Previous versions of NB did show the connection details
> but if I edited for EE JPA and then generated the controllers they were
> still generated. The controllers are generated from the entities so why is
> the generator even looking at persistence.xml.
>
> Then there are the controllers themselves. They have been optimized for
> stand alone, resource local usage. The optimizations, especially the use of
> finally clauses to eliminate catch clauses makes no sense to me. Many but
> not all exceptions simply result in an em.close(). This is effectively the
> same as having an empty catch clause. Plus, with an injected  EntityManager
> you should not be closing it, if I understand how CDI works. There is no
> rollback anywhere. If the JPA now rolls back automatically when an
> exception occurs I’ll withdraw this complaint but I doubt it does.
>
> I could go on. If you want to see what controllers used to look like and
> what had to be changed for EE look at my blog
> https://www.omniprogrammer.com/?p=383.
>
> Is the JPA used more extensively on the desktop? I don’t think so. Here I
> take the blame for not pointing out that there needs to be JPA generation
> for Application Servers. If you look at my blog you can see that the
> changes were minimal to the old generated code. Now the changes will need
> to be more extensive.
>
> I have to stop now because I’m angry. Tomorrow morning I have to face a
> class and before that I need to decide if I should tell them to cut and
> paste code from my samples and change the names of objects or show them all
> the changes needed to make the generated code work.
>
> Please tell me I have it all wrong and I’ll be happy to apologize for this
> missive and never darken this mailing list again. I will also be happy to
> contribute JPA/EE controller templates if my concerns are valid.
>
> Ken
>
>
>
>
>
>

Re: JPA Controller Generation

Posted by Kenneth Fogel <kf...@dawsoncollege.qc.ca>.
I have calmed down and wish to apologize for the harshness of my comments last night. I will download the latest source and review the code that generates the controllers et all. I will suggest that there should be two choices for JPA Controllers, one for stand alone and one for application server managed.

Ken

________________________________
From: Kenneth Fogel <kf...@dawsoncollege.qc.ca>
Sent: Friday, February 14, 2020 12:51:59 AM
To: dev@netbeans.apache.org <de...@netbeans.apache.org>
Subject: JPA Controller Generation

I have been using NetBeans, as many of you know, for years. In the winter I teach an EE course that uses the JPA. In using the New -> JPA Controllers from Entities I couldn’t believe what came out. Let’s review two changes:

If the persistence.xml file does not declare a connection (url, user, pwd) the generated controllers are empty. When this file is used for EE JPA you declare the connection in glassfish-resources.xml and not the persistence.xml. Previous versions of NB did show the connection details but if I edited for EE JPA and then generated the controllers they were still generated. The controllers are generated from the entities so why is the generator even looking at persistence.xml.

Then there are the controllers themselves. They have been optimized for stand alone, resource local usage. The optimizations, especially the use of finally clauses to eliminate catch clauses makes no sense to me. Many but not all exceptions simply result in an em.close(). This is effectively the same as having an empty catch clause. Plus, with an injected  EntityManager you should not be closing it, if I understand how CDI works. There is no rollback anywhere. If the JPA now rolls back automatically when an exception occurs I’ll withdraw this complaint but I doubt it does.

I could go on. If you want to see what controllers used to look like and what had to be changed for EE look at my blog https://www.omniprogrammer.com/?p=383.

Is the JPA used more extensively on the desktop? I don’t think so. Here I take the blame for not pointing out that there needs to be JPA generation for Application Servers. If you look at my blog you can see that the changes were minimal to the old generated code. Now the changes will need to be more extensive.

I have to stop now because I’m angry. Tomorrow morning I have to face a class and before that I need to decide if I should tell them to cut and paste code from my samples and change the names of objects or show them all the changes needed to make the generated code work.

Please tell me I have it all wrong and I’ll be happy to apologize for this missive and never darken this mailing list again. I will also be happy to contribute JPA/EE controller templates if my concerns are valid.

Ken