table « EntityManager « JPA Q&A





1. How can I get information out of a junction table using JPA/EclipseLink?    stackoverflow.com

I have the following many-to-many mapping:

public class Student implements
{
    @Id
    @GeneratedValue
    private Integer xID;

@ManyToMany
@JoinTable(name = "x_y", 
     joinColumns ...

2. Strange JPA behaviour: tables cleaned at app boot    stackoverflow.com

Almost all is in the title... Persistence is working fine when app launched, and row are still in DB when the app is closed, but once app is loaded, rows got ...

3. EntityManager.merge() does not create table record    stackoverflow.com

The following code fails to create a new record reliably.

TransferRecord transfer = new TransferRecord();
transfer.setTransferId(metaData.getTransferId());
transfer.setUserName(metaData.getUserId().getUserName());
transfer.setCancelled(false);
em.merge(transfer);
em.flush();
Here's the code for the transfer record:
/***
 * Contains a record of an ongoing transfer.
 * @author anchapma
 ...

4. JPA and JPQL: NoResultException when selecting from multiple tables where one value is null    stackoverflow.com

I'm using Java EE 6 and query a database using JPA's javax.persistence.Entitymanager. I have a JPQL query code snippet that looks like something like this:

Query query = entityManager.createQuery("
    ...