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


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

Re: Is there a simpler way to map Hibernate?

Path csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Is there a simpler way to map Hibernate?
Date Sun, 10 Sep 2023 20:48:21 -0400
Organization A noiseless patient Spider
Lines 27
Message-ID <udlo4l$otip$1@dont-email.me> (permalink)
References <015e1e01-2e15-49bf-ae5e-07470e4e3d2bn@googlegroups.com> <ucr57u$3fa1g$1@dont-email.me> <c7dbfc66-c143-45f0-8501-50d9aa90e3b2n@googlegroups.com> <ucslb3$3p6nj$1@dont-email.me> <f0746a5b-9125-4055-b2a4-de230c621f6cn@googlegroups.com> <ucsnkr$3pftv$1@dont-email.me> <69105518-21d7-468c-9774-e9ffb497677fn@googlegroups.com> <ucspf7$3ppii$1@dont-email.me> <74cf0893-49c0-46dc-8381-92244f60bde1n@googlegroups.com>
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 11 Sep 2023 00:48:22 -0000 (UTC)
Injection-Info dont-email.me; posting-host="28ca6c9d5c554b433b19a6c64ccf821f"; logging-data="816729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nWosKrb7Qg1m+IL0B1mjBgtLI+pdXF9Q="
User-Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0
Cancel-Lock sha1:r0KhJBzOBGrojh+kC0oz53jyL9c=
In-Reply-To <74cf0893-49c0-46dc-8381-92244f60bde1n@googlegroups.com>
Content-Language en-US
Xref csiph.com comp.lang.java.programmer:40011

Show key headers only | View raw


On 9/5/2023 3:34 PM, e.d.pro...@gmail.com wrote:
>> Yes. Basically:
>> 
>> EntityManagerFactory emf =
>> Persistence.createEntityManagerFactory(confnam); EntityManager em =
>> emf.createEntityManager();
>> 
>> instead of:
>> 
>> SessionFactory sf = new Configuration().configure(new 
>> File(conffile)).buildSessionFactory(); Session s =
>> sf.openSession();
> ...
> 
> This is confusing. I've been implementing the openSession using
> try-with-resources. org.hibernate.Session extends
> javax.persistence.EntityManager (I'm using Hibernate 5x since 6x
> requires newer Java, stuck using Java 8 for now) as well as
> Autocloseable. EntityManager is not autocloseable,

If Session extends EntityManager you should be able to
use the JPA methods on Session and just use Session auto closeable
feature.

Arne

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


Thread

Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-08-31 04:49 -0700
  Re: Is there a simpler way to map Hibernate? Arne Vajhøj <arne@vajhoej.dk> - 2023-08-31 18:46 -0400
    Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-01 04:08 -0700
      Re: Is there a simpler way to map Hibernate? Arne Vajhøj <arne@vajhoej.dk> - 2023-09-01 08:27 -0400
        Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-01 05:49 -0700
          Re: Is there a simpler way to map Hibernate? Arne Vajhøj <arne@vajhoej.dk> - 2023-09-01 09:06 -0400
            Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-01 06:25 -0700
              Re: Is there a simpler way to map Hibernate? Arne Vajhøj <arne@vajhoej.dk> - 2023-09-01 09:37 -0400
                Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-01 12:48 -0700
                Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-05 12:34 -0700
                Re: Is there a simpler way to map Hibernate? Arne Vajhøj <arne@vajhoej.dk> - 2023-09-10 20:48 -0400
                Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-11 04:19 -0700
                Re: Is there a simpler way to map Hibernate? "e.d.pro...@gmail.com" <e.d.programmer@gmail.com> - 2023-09-11 05:23 -0700

csiph-web