本文整理汇总了Java中org.jboss.as.quickstarts.kitchensink.model.Member类的典型用法代码示例。如果您正苦于以下问题:Java Member类的具体用法?Java Member怎么用?Java Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Member类属于org.jboss.as.quickstarts.kitchensink.model包,在下文中一共展示了Member类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findByEmail
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public Member findByEmail(String email) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
Root<Member> member = criteria.from(Member.class);
// Swap criteria statements if you would like to try out type-safe criteria queries, a new
// feature in JPA 2.0
// criteria.select(member).where(cb.equal(member.get(Member_.name), email));
criteria.select(member).where(cb.equal(member.get("email"), email));
return em.createQuery(criteria).getSingleResult();
}
示例2: findAllOrderedByName
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public List<Member> findAllOrderedByName() {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
Root<Member> member = criteria.from(Member.class);
// Swap criteria statements if you would like to try out type-safe criteria queries, a new
// feature in JPA 2.0
// criteria.select(member).orderBy(cb.asc(member.get(Member_.name)));
criteria.select(member).orderBy(cb.asc(member.get("name")));
return em.createQuery(criteria).getResultList();
}
示例3: lookupMemberById
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@GET
@Path("/{id:[0-9][0-9]*}")
@Produces(MediaType.APPLICATION_JSON)
public Member lookupMemberById(@PathParam("id") long id) {
Member member = repository.findById(id);
if (member == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return member;
}
示例4: emailAlreadyExists
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
/**
* Checks if a member with the same email address is already registered. This is the only way to easily capture the
* "@UniqueConstraint(columnNames = "email")" constraint from the Member class.
*
* @param email The email to check
* @return True if the email already exists, and false otherwise
*/
public boolean emailAlreadyExists(String email) {
Member member = null;
try {
member = repository.findByEmail(email);
} catch (NoResultException e) {
// ignore
}
return member != null;
}
示例5: createTestArchive
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@Deployment
public static Archive<?> createTestArchive() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(Member.class, MemberRegistration.class, Resources.class)
.addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
// Deploy our test datasource
.addAsWebInfResource("test-ds.xml");
}
示例6: testRegister
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@Test
public void testRegister() throws Exception {
Member newMember = new Member();
newMember.setName("Jane Doe");
newMember.setEmail("[email protected]");
newMember.setPhoneNumber("2125551234");
memberRegistration.register(newMember);
assertNotNull(newMember.getId());
log.info(newMember.getName() + " was persisted with id " + newMember.getId());
}
示例7: findByEmail
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public Member findByEmail(String email) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
Root<Member> member = criteria.from(Member.class);
// Swap criteria statements if you would like to try out type-safe criteria queries, a new
// feature in JPA 2.0
// criteria.select(member).where(cb.equal(member.get(Member_.email), email));
criteria.select(member).where(cb.equal(member.get("email"), email));
return em.createQuery(criteria).getSingleResult();
}
示例8: getMembers
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@Produces
@Named
public List<Member> getMembers() {
return members;
}
示例9: onMemberListChanged
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public void onMemberListChanged(@Observes(notifyObserver = Reception.IF_EXISTS) final Member member) {
retrieveAllMembersOrderedByName();
}
示例10: findById
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public Member findById(Long id) {
return em.find(Member.class, id);
}
示例11: initNewMember
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@PostConstruct
public void initNewMember() {
newMember = new Member();
}
示例12: register
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
public void register(Member member) throws Exception {
log.info("Registering " + member.getName());
em.persist(member);
memberEventSrc.fire(member);
}
示例13: listAllMembers
import org.jboss.as.quickstarts.kitchensink.model.Member; //导入依赖的package包/类
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Member> listAllMembers() {
return repository.findAllOrderedByName();
}