當前位置: 首頁>>代碼示例>>Java>>正文


Java Member類代碼示例

本文整理匯總了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();
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:11,代碼來源:MemberRepository.java

示例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();
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:11,代碼來源:MemberRepository.java

示例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;
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:11,代碼來源:MemberResourceRESTService.java

示例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;
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:17,代碼來源:MemberResourceRESTService.java

示例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");
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:10,代碼來源:MemberRegistrationTest.java

示例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());
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:11,代碼來源:MemberRegistrationTest.java

示例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();
}
 
開發者ID:wfink,項目名稱:jboss-as-quickstart,代碼行數:11,代碼來源:MemberRepository.java

示例8: getMembers

import org.jboss.as.quickstarts.kitchensink.model.Member; //導入依賴的package包/類
@Produces
@Named
public List<Member> getMembers() {
    return members;
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:6,代碼來源:MemberListProducer.java

示例9: onMemberListChanged

import org.jboss.as.quickstarts.kitchensink.model.Member; //導入依賴的package包/類
public void onMemberListChanged(@Observes(notifyObserver = Reception.IF_EXISTS) final Member member) {
    retrieveAllMembersOrderedByName();
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:4,代碼來源:MemberListProducer.java

示例10: findById

import org.jboss.as.quickstarts.kitchensink.model.Member; //導入依賴的package包/類
public Member findById(Long id) {
    return em.find(Member.class, id);
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:4,代碼來源:MemberRepository.java

示例11: initNewMember

import org.jboss.as.quickstarts.kitchensink.model.Member; //導入依賴的package包/類
@PostConstruct
public void initNewMember() {
    newMember = new Member();
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:5,代碼來源:MemberController.java

示例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);
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:6,代碼來源:MemberRegistration.java

示例13: listAllMembers

import org.jboss.as.quickstarts.kitchensink.model.Member; //導入依賴的package包/類
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Member> listAllMembers() {
    return repository.findAllOrderedByName();
}
 
開發者ID:wemakestuff,項目名稱:Teracast,代碼行數:6,代碼來源:MemberResourceRESTService.java


注:本文中的org.jboss.as.quickstarts.kitchensink.model.Member類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。