Skip to content

Commit

Permalink
Merge pull request quarkusio#39072 from barreiro/agroal-2.3
Browse files Browse the repository at this point in the history
Update to Agroal 2.3
  • Loading branch information
yrodiere authored Mar 4, 2024
2 parents d63aecd + 22a463b commit 607ece4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<!-- When updating, align hibernate-search.version-for-documentation in docs/pom.xml -->
<hibernate-search.version>7.1.0.Final</hibernate-search.version>
<narayana.version>7.0.0.Final</narayana.version>
<agroal.version>2.1</agroal.version>
<agroal.version>2.3</agroal.version>
<jboss-transaction-spi.version>8.0.0.Final</jboss-transaction-spi.version>
<elasticsearch-opensource-components.version>8.12.2</elasticsearch-opensource-components.version>
<rxjava.version>2.2.21</rxjava.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ public void initData() throws Exception {
transaction.begin();
DefaultEntity entity = new DefaultEntity("default");
defaultSession.persist(entity);
transaction.commit();
transaction.begin();
User user = new User("user");
usersSession.persist(user);
transaction.commit();
transaction.begin();
Plane plane = new Plane("plane");
inventorySession.persist(plane);
transaction.commit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;
import jakarta.transaction.Transactional;
import jakarta.transaction.UserTransaction;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
Expand Down Expand Up @@ -39,26 +40,34 @@ public class MultiplePersistenceUnitsPackageAnnotationsTest {
@PersistenceUnit("inventory")
EntityManager inventoryEntityManager;

@Inject
UserTransaction transaction;

@Test
@Transactional
public void testDefault() {
public void testDefault() throws Exception {
transaction.begin();
SharedEntity defaultEntity = new SharedEntity("default");
defaultEntityManager.persist(defaultEntity);

SharedEntity savedDefaultEntity = defaultEntityManager.find(SharedEntity.class, defaultEntity.getId());
assertEquals(defaultEntity.getName(), savedDefaultEntity.getName());
transaction.commit();

transaction.begin();
SharedEntity defaultEntity2 = new SharedEntity("default2");
usersEntityManager.persist(defaultEntity2);

SharedEntity savedDefaultEntity2 = usersEntityManager.find(SharedEntity.class, defaultEntity2.getId());
assertEquals(defaultEntity2.getName(), savedDefaultEntity2.getName());
transaction.commit();

transaction.begin();
SharedEntity defaultEntity3 = new SharedEntity("default3");
inventoryEntityManager.persist(defaultEntity3);

SharedEntity savedDefaultEntity3 = inventoryEntityManager.find(SharedEntity.class, defaultEntity3.getId());
assertEquals(defaultEntity3.getName(), savedDefaultEntity3.getName());
transaction.commit();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void testUserInInventoryEntityManager() {
}

@Test
@Transactional
public void testAccessBothPersistenceUnits() {
testUser();
testPlane();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void testUserInInventorySession() {
}

@Test
@Transactional
public void testAccessBothPersistenceUnits() {
testUser();
testPlane();
Expand Down

0 comments on commit 607ece4

Please sign in to comment.