Page 1 of 1

About Question enthuware.oce-jpad.v6.2.566 :

Posted: Sat May 10, 2014 5:29 pm
by evefuji
Only to confirm, "INSERT INTO table VALUES(:parameter)" not is specified in JPQL like exists in HQL right?

Exists any method to not use native query to get anything like?:

INSERT INTO table1
SELECT * FROM table2;

Or "INSERT FIRST"/"INSERT ALL"?

Re: About Question enthuware.oce-jpad.v6.2.566 :

Posted: Sat May 10, 2014 8:16 pm
by admin
No, "Insert into table" does not exist in JPQL because ideally you should be creating entities using the new keyword and then persisting them using the entity manager. For example: Student s = new Student(); entityManager.persist(s);

You have to use native query to do "insert into...".

I am not aware of HQL.

HTH,
Paul.

Re: About Question enthuware.oce-jpad.v6.2.566 :

Posted: Wed Sep 23, 2015 4:22 pm
by romsky
Option 4 is correct.
JPQL can NOT be used to update JPA 2.0 Entities. To update database, but not entities.

Re: About Question enthuware.oce-jpad.v6.2.566 :

Posted: Wed Sep 23, 2015 10:20 pm
by admin
It is actually used in the same sense as the one mentioned by the specification section 4.2 (Page 133) :
The update and delete clauses determine the type of the entities to be updated or deleted.
Also, you cannot update just about any database table using JPQL because it works on "entities" defined in your abstract schema.