R.Kaka
R.Kaka

Reputation: 167

JPA where clause condition

I'm using hibernate 3 within this mapping in hbm.xml file:

<class table="mtl_material_transactions" 
        name="com.kaka.oracle.model.inventory.transactions.MaterialTransaction" 
        where="transaction_type_id in (35,44,90)" 
        schema="apps">

The key point is where, how can I do the same with JPA 2.0 (hibernate 4.1.9 final as provider).

Upvotes: 1

Views: 3129

Answers (1)

Learner
Learner

Reputation: 21393

You can use the @where annotation, see this link for details:

Hibernate @Where clause

For example your entity looks like this:

@Entity
@Table(name = "mtl_material_transactions", schema="apps")
@Where(clause="transaction_type_id in (35,44,90)")
public class MaterialTransaction {
   ...
}

Upvotes: 2

Related Questions