我有以下JPA类.
/**
* The persistent class for the ACCOUNT database table.
*
*/
@Entity
@Table(name="ACCOUNT")
public class Account implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@XmlID
@Column(name="ACCOUNT_NO", unique=true, nullable=false, length=50)
private String accountNo;
Run Code Online (Sandbox Code Playgroud)
`
我正在使用EJB来获取匹配的帐户.
/**
* Session Bean implementation class Account
*/
@Stateless
public class AccountBean implements AccountRemote {
@Override
public List<Account> searchAccount(String searchKeyword) {
TypedQuery<Account> query = entityManager.createQuery(" select a from " + Account.class.getName() +" a where a.ACCOUNT_NO LIKE :searchKeyword ",Account.class);
query.setParameter("searchKeyword", "%"+searchKeyword+"%");
return …
Run Code Online (Sandbox Code Playgroud)