Sera que eu estou esquecendo algo?
public static void main(String[] args) {
Categoria celulares = new Categoria("Celular");
EntityManager em = JPAUtil.getEntityManager();
em.getTransaction().begin();
em.persist(celulares);
celulares.setNome("XPTO");
em.flush();
em.clear();
celulares = em.merge(celulares);
celulares.setNome("1234");
em.flush();
set. 22, 2022 7:40:54 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections INFO: HHH000115: Hibernate connection pool size: 20 (min=1) set. 22, 2022 7:40:54 AM org.hibernate.dialect.Dialect INFO: HHH000400: Using dialect: org.hibernate.dialect.H2Dialect set. 22, 2022 7:40:54 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@1457fde] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. Hibernate: create table categorias (id bigint generated by default as identity, nome varchar(255), primary key (id)) Hibernate: create table produtos (id bigint generated by default as identity, data date, descricao varchar(255), nome varchar(255), preco decimal(19,2), categoria_id bigint, primary key (id)) Hibernate: alter table produtos add constraint FK8rqw0ljwdaom34jr2t46bjtrn foreign key (categoria_id) references categorias set. 22, 2022 7:40:54 AM org.hibernate.engine.transaction.jta.platform.internal.JtaPlatformInitiator initiateService INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] Hibernate: insert into categorias (id, nome) values (null, ?) Hibernate: select categoria0_.id as id1_0_0_, categoria0_.nome as nome2_0_0_ from categorias categoria0_ where categoria0_.id=?