我正在使用带有buildin OpenJPA 1.2.3和Oracle数据库的Websphere Application Server 7.我有以下实体:
@NamedNativeQuery(name=Contract.GIVE_ALL_CONTRACTS,
query="SELECT number, name \n" +
"FROM contracts \n" +
"WHERE startdate <= ?1 \n" +
"AND enddate > ?1",
resultSetMapping = Contract.GIVE_ALL_CONTRACTS_MAPPING)
@SqlResultSetMapping(name = Contract.GIVE_ALL_CONTRACTS_MAPPING,
entities = { @EntityResult(entityClass = Contract.class, fields = {
@FieldResult(name = "number", column = "number"),
@FieldResult(name = "name", column = "name")
})
})
@Entity
public class Contract {
public static final String GIVE_ALL_CONTRACTS = "Contract.giveAllContracts";
public static final String GIVE_ALL_CONTRACTS_MAPPING = "Contract.giveAllContractsMapping";
@Id
private Integer number;
private String …Run Code Online (Sandbox Code Playgroud)