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

Moderator: admin

Post Reply
evefuji
Posts: 21
Joined: Fri Apr 11, 2014 8:57 pm
Contact:

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

Post 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"?

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

romsky
Posts: 39
Joined: Thu Jan 29, 2015 4:49 pm
Contact:

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

Post by romsky »

Option 4 is correct.
JPQL can NOT be used to update JPA 2.0 Entities. To update database, but not entities.

admin
Site Admin
Posts: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests