Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 3 weeks ago
JPA Container many to many problem
I have problem on my application.
When I update its child data.. it successfuly sent to database
But when I access its child data on an Entity Class..
The data doesn't updated..
Also I made my connection with this code
public class AdminHomeView extends Panel implements View {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String EDIT_ID = "dashboard-edit";
public static final String TITLE_ID = "dashboard-title";
private EntityManagerFactory emf = Persistence.createEntityManagerFactory(ApplicationUI.JPA);
private EntityManager em = emf.createEntityManager();
private Label titleLabel;
private CssLayout dashboardPanels;
private final VerticalLayout root;
and my Entities are made like this
@Entity
@Table(name = "users")
public class Users implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String username;
private String password;
private boolean active;
@Temporal(TemporalType.TIMESTAMP)
private Date created_at;
@Temporal(TemporalType.TIMESTAMP)
private Date updated_at;
@ManyToOne
@JoinColumn(name = "level_id")
private User_level user_level;
@ManyToMany(targetEntity = System_queries.class)
private List<System_queries> systemQueriesSet;@Entity
@Table(name = "system_queries")
public class System_queries implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name = "title")
private String title;
@Column(name = "description")
private String description;
@Column(name = "statement")
private String statement;
@Temporal(TemporalType.TIMESTAMP)
private Date created_at;
@Temporal(TemporalType.TIMESTAMP)
private Date updated_at;
@ManyToMany
@JoinTable(name = "users_system_queries",
joinColumns={
@JoinColumn(name = "systemQueriesSet_ID")
},
inverseJoinColumns={
@JoinColumn(name = "Users_ID")
})
private List<Users> userSet;
My theory is that the data should be updated because each time I change view the Page get Instantiaded again..
But why does the entity child wont be updated?
Last updated on
You cannot reply to this thread.