iLMS知識社群(Sites)師生部落格(Blogs)朝陽首頁(Homepage)TronClass教學平台登入
位置: 陳鉞勳 > 未分類
JSF
by 陳鉞勳 2018-05-01 17:43:39, 回應(8), 人氣(174)
0501

JavaEE ->EJB Module
回應(8)
JavaEE ->EJB Module:TimeServiceModule
New->Pakage
New->Interfece:TimeService.java
New->SessionBean(@Stateless):
TimeServiceBean.java
TimeServiceModule->右鍵->Deploy
Servies->Servers->GlassFish->application(右鍵)->view

New->applicaiton:Client
(右鍵)add project:TimeServiceModule


Add the following jars to your project:

  • the EJB project you just created
  • [glassfish_home]/glassfish/lib/jndi-properties.jar
  • [glassfish_home]/glassfish/lib/gf-client.jar
Create DataBase(Servies)

New->Persistence unit

New source->jdbc/unit07DB

Create and Drop
New-pakage(entities)

New-entity class(item)
new->Session Bean

@Stateless
@LocalBean
public class ItemFacade {

    @PersistenceContext(unitName="Unit07PU")
    private EntityManager em;
}


然後Deploy(部署)
0515
1.Create DataBase(Servies)
2.New->Web
3.New->Persistence unit
New source->jdbc/jdbcunit08DB
選Create(每次開啟都會重新Create)

session_bean package -> New:Persistence -> Session Bean for Entity Class
選取要的Entity
finish

Deploy and Refresh Database
0522

Connect Database

New -> entities -> New Entity from Dadabase -> choose table

New-> ejb ->Session Bean for Entity -> Add all (自動幫每個Table建立Facade)
Persistence -> 右鍵 Run JPQL Query

先Bulid 再下語法

回應