Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32376
| Path | csiph.com!news.mixmin.net!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Why save the EntityManagerFactory |
| Date | Wed, 19 Aug 2015 19:15:43 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 17 |
| Message-ID | <mr32n2$9aq$2@speranza.aioe.org> (permalink) |
| References | <87a8tnr2kq.fsf@Equus.decebal.nl> |
| NNTP-Posting-Host | 6sQnVX30ysopbfpJ+C2lEQ.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.lang.java.programmer:32376 |
Show key headers only | View raw
On 8/19/2015 6:32 AM, Cecil Westerhof wrote:
> I am using http://www.uow.edu.au/~nabg/399/JPA/JPA.pdf to get a start
> with JPA. When looking at page 14 an EntityManagerFactory is created
> and kept until the end of the program.
> Could the following:
> emf = Persistence.createEntityManagerFactory("JavaApplication12PU");
> em = emf.createEntityManager();
> not just be changed to:
> em = Persistence.createEntityManagerFactory("JavaApplication12PU").createEntityManager();
If emf is not used later then I can not see any point.
In Java EE context you would typical let the container inject what you need.
Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why save the EntityManagerFactory Cecil Westerhof <Cecil@decebal.nl> - 2015-08-19 12:32 +0200
Re: Why save the EntityManagerFactory Arne Vajhøj <arne@vajhoej.dk> - 2015-08-19 19:15 -0400
Re: Why save the EntityManagerFactory Eternal Hope <laughingspam99@gmail.com> - 2015-08-21 09:43 +0100
Re: Why save the EntityManagerFactory Arne Vajhøj <arne@vajhoej.dk> - 2015-08-30 21:55 -0400
Re: Why save the EntityManagerFactory Lew <lewbloch@gmail.com> - 2015-08-31 10:13 -0700
csiph-web