Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32360

Why save the EntityManagerFactory

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.java.programmer
Subject Why save the EntityManagerFactory
Date Wed, 19 Aug 2015 12:32:21 +0200
Organization Decebal Computing
Lines 13
Message-ID <87a8tnr2kq.fsf@Equus.decebal.nl> (permalink)
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="528adfd6ad074c92fdc6a7f8fb9e23d8"; logging-data="15928"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18z8qlAylCFJAuWDYTcoxvTY+fYT8G1vd8="
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
X-Homepage http://www.decebal.nl/
Cancel-Lock sha1:IO9zp5UqXKYFMO2Tujz4O+65sj4= sha1:ndd2MZepJ+5cj6Hwm6aLVpgLpwo=
Xref csiph.com comp.lang.java.programmer:32360

Show key headers only | View raw


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();

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


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