tags:

views:

29

answers:

2

I have to go through some code of a project to implement some missiong functionality. It uses jpa.In some popj classes i have found

@Entity
@Table(name="TYPE")
@NamedQueries( { 
 @NamedQuery(name = "getTypes", query = "SELECT dct FROM Type dct") 
})

I know that i can used to get all records by using this query.Does this query return all records in type table?

+1  A: 

Yes, it does. It generates an SQL query that looks roughly like this:

SELECT [column list here] FROM type
Bozho
+1  A: 

This query will return all the Type entities including subtypes, if any. And since I can't say if this there are any subtypes, I can't say if this query will be restricted to the TYPE table.

Pascal Thivent
hm, good point. I didn't assume inheritance, because there is no `@Inheritance` or `@MappedSuperclass`, but it's not impossible to have some hierarchy.
Bozho
@Bozho Yeah, the class could be part of a hierarchy so I just made the answer generic, just in case. But the OP should provide the class definition for such questions.
Pascal Thivent