1
How can I enter a data with JPQL containing values:
@Query("insert into user values()")
User insertUser();
Dice: nomeUsuario emailUsuario
1
How can I enter a data with JPQL containing values:
@Query("insert into user values()")
User insertUser();
Dice: nomeUsuario emailUsuario
1
Thus:
String query = "insert into User values(?,?)";
EntityManager em = emf.createEntityManager();
em.createNativeQuery(query)
.setParameter(1, "maria")
.setParameter(2, "123456")
.executeUpdate();
Browser other questions tagged java query jpa sql-insert jpql
You are not signed in. Login or sign up in order to post.
When creating questions, think carefully about tags. Having forgotten to put [java] and [jpa] tags was to ask not to receive good answers, since there are many people who receive notifications of content by tags and your question would not be noticed by some people able to answer you. I already added the tags.
– Victor Stafusa