Hibernate Shared SessionsJava

Java-Forum
Anonymous
 Hibernate Shared Sessions

Post by Anonymous »

Seit ich zu Hibernate 6.x+ Migrierte, hatte ich Probleme mit gemeinsamen Sitzungen in Einheitssitzungen. (Banane), aber ich empfange die Nachricht:
verursacht durch: org.hiNNATE.NONUNICEOBJECTEException: Ein anderes Objekt mit demselben Identifikatorwert wurde bereits mit der Sitzung verbunden: [Banana#123] < /p>
Dieses Verhalten trat nicht auf. Test < /p>

Code: Select all

@SpringBootTest
@RunWith(SpringRunner.class)
public class BananaConcurrentDeletedTest {

private static final int THREADS = 10;
private static final int ITERATIONS = 15;
private static final String BANANA_ID = "123";

@Autowired
private BananaConcurrentDeletedFixture fixture;

@Test
public void ensureConcurrentBananaIsCorrect() throws Exception {

createBanana();

Set bananaIds = new HashSet();
ids.add(BANANA_ID);

Target target = new Target(ids);

for (int i=0; i
Meine Ziel -Implemtation: < /p>
private class Target implements Runnable {
private final CountDownLatch startLatch = new CountDownLatch(THREADS);
private final CountDownLatch endLatch = new CountDownLatch(THREADS);

private final Set ids;

public Target(Set ids) {
this.ids = ids;
}

@Override
public void run() {
try {
startLatch.countDown();
startLatch.await();

for (int i=0; i
Das [url=viewtopic.php?t=20324]Problem[/url] tritt auf, wenn ich das Objekt vor dem Initialisieren der Threads erstelle. Ich habe bereits versucht, es mit @transactional (Propagation = fordert_new) 
zu isolieren, aber ohne Erfolg.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post