iahsan
iahsan

Reputation: 115

Oracle query Java EE, Entity Manager

If I have an Oracle database, with structure, SCHEMA/TABLE1 SCHEMA/TABLE2 and I want to create a query to select all rows from Table1, would it be,

"Select x from SCHEMA.TABLE1 x"

Upvotes: 1

Views: 378

Answers (1)

Xavi López
Xavi López

Reputation: 27880

If you have an entity such as:

@Entity
@Table(schema="SCHEMA", name="TABLE1")
public class Table1Class { 
 ...
}

Then, the following basic JPQL Query would select all the Table1Class entities:

Select x from Table1Class x.

Summing up, you don't need to (not that you can, either) specify schema and table name on JPQL queries, just the class name the table is mapped to.

Upvotes: 1

Related Questions