ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>青青草视频在线免费直播,中文字幕av一区二区三区佐山爱,欧美精品一区二区精品网http://www.aygfsteel.com/robbie/category/22240.htmlzh-cnFri, 15 Jun 2007 16:41:50 GMTFri, 15 Jun 2007 16:41:50 GMT60Hibernate3.2 ä¸?EJB3.0http://www.aygfsteel.com/robbie/archive/2007/05/10/116593.html三十而立三十而立Thu, 10 May 2007 13:08:00 GMThttp://www.aygfsteel.com/robbie/archive/2007/05/10/116593.htmlhttp://www.aygfsteel.com/robbie/comments/116593.htmlhttp://www.aygfsteel.com/robbie/archive/2007/05/10/116593.html#Feedback1http://www.aygfsteel.com/robbie/comments/commentRss/116593.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/116593.html
看来å¯ÒŽ(gu¨©)–°æŠ€æœ¯äº†(ji¨£n)解不够,只顾äº?ji¨£n)看EJB3.0的规范了(ji¨£n)

感觉Hibernate3.2全面支持EJB3.0的规范对于EJB3的推òq¿æ¥è¯´æ˜¯ä»¶å¥½äº‹ï¼Œè‡›_°‘在ORM˜q™æ–¹é¢ï¼Œä¸€èˆ¬ç¨‹åºå‘˜¿U¯ç¯çš„经验可以很快速的适应EJB3.0的开发。只要ç‘ô¾l­åŠ å¼ºå¯¹EJB容器、事务处理等斚w¢çš„å­¦ä¹?f¨¤n),ž®±å¯ä»¥å¯¹EJB3有全面完整的äº?ji¨£n)解。比起以前EJB2.1和常用技术的格格不入而言åQŒçœŸçš„æ˜¯å¾ˆå¤§çš„进步了(ji¨£n)ã€?

]]>
EJB3.0 -- Study -- 1http://www.aygfsteel.com/robbie/archive/2007/05/07/115712.html三十而立三十而立Mon, 07 May 2007 15:42:00 GMThttp://www.aygfsteel.com/robbie/archive/2007/05/07/115712.htmlhttp://www.aygfsteel.com/robbie/comments/115712.htmlhttp://www.aygfsteel.com/robbie/archive/2007/05/07/115712.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/115712.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/115712.htmlEntityManager的定�br>
The EntityManager manages the O/R mapping between a fixed set of entity classes and an underlying data source.
It provides APIs for creating queries, finding objects, synchronizing objects, and inserting objects into the database.
It also can provide caching and manage the interaction between an entity and transactional services in a Java EE environment such as JTA.
The EntityManager is tightly integrated with Java EE and EJB but is not limited to this environment; it can be used in plain Java programs.

An EntityManager maps a fixed set of classes to a particular database. This set of classes is called a persistence unit .

In Java SE, entity managers are created using a javax.persistence.EntityManagerFactory
ExampleåQ?br>    EntityManagerFactory factory = Persistence.createEntityManagerFactory("titan", map);
    EntityManager manager = factory.createEntityManager();
在Java SE环境中,使用完EntityManagerFactory后,最好将其关闭,以释攑օ¶å æœ‰çš„资源ã€?br>
å’ŒJava SEçŽ¯å¢ƒä¸ä¸€æ øP¼Œåœ¨Java EE中,一个注入的EntityManagerFactoryä¼?x¨¬)被EJB容器自动关闭åQŒå®žé™…上åQŒå¦‚果你调用EntityManagerFactoryçš„clost()æ–ÒŽ(gu¨©)³•æ—Óž¼Œä¼?x¨¬)抛出IllegalStateException异常ã€?

public interface EntityManager {
   public void persist(Object entity);
   public <T> T find(Class <T> entityClass, Object primaryKey);
   public <T> T getReference(Class <T> entityClass, Object primaryKey);
   public <T> T merge(T entity);
   public void remove(Object entity);
   public void lock(Object entity, LockModeType lockMode);

   public void refresh(Object entity);
   public boolean contains(Object entity);
   public void clear( );

   public void joinTransaction( );
   public void flush( );
   public FlushModeType getFlushMode( );
   public void setFlushMode(FlushModeType type);

   public Query createQuery(String queryString);
   public Query createNamedQuery(String name);
   public Query createNativeQuery(String sqlString);
   public Query createNativeQuery(String sqlString, String resultSetMapping);
   public Query createNativeQuery(String sqlString, Class resultClass);

   public Object getDelegate( );

   public void close( );
   public boolean isOpen( );
}

Persistence context的定�br>
A persistence context is a set of managed entity object instances.
Persistence contexts are managed by an entity manager.

There are two types of persistence contexts: transaction-scoped and extended persistence contexts.

A persistence context can be created by calling the EntityManagerFactory.createEntityManager( ) method. The returned EntityManager instance represents an extended persistence context. If the EntityManagerFactory is JTA-enabled, then you have to explicitly enlist the EntityManager instance within a transaction by calling the EntityManager.joinTransaction( ) method. If you do not enlist the EntityManager within the JTA transaction, then changes you make to your entities are not synchronized with the database.

FlushModeType的含�br>
FlushModeType默认为AUTO模式åQŒå½“为AUTOæ—Óž¼Œåœ¨ä¸€ä¸ªæŸ¥è¯¢è¢«æ‰§è¡Œå‰ï¼Œä¼?x¨¬)自动将变化提交到数据库中,卌™°ƒç”¨flush()æ–ÒŽ(gu¨©)³•。但是调用find()或getreference()æ–ÒŽ(gu¨©)³•æ—Óž¼Œòq¶ä¸ä¼?x¨¬)执行自动提交。当为COMMIT模式æ—Óž¼Œä»…仅在事务提交时åQŒä¼š(x¨¬)ž®†å˜åŒ–提交到数据库中ã€?br>
EJB3中的实体注解规范参见如下链接
http://wiki.redsaga.com/confluence/display/HART/Home



]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º Ì«¿µÏØ| ÓÀ¿µÊÐ| Çì°²ÏØ| ¹ó¸ÛÊÐ| °²ÏçÏØ| ÀϺӿÚÊÐ| ºÏ½­ÏØ| ÃöÇåÏØ| ÓÀÈÊÏØ| ½ðÐã| ½­Ô´ÏØ| Ð˳ÇÊÐ| ½ÒÑôÊÐ| Û°³ÇÏØ| Ö¦½­ÊÐ| ÅîÀ³ÊÐ| Çà´¨ÏØ| »ÆÊ¯ÊÐ| ÆÖÏØ| ½ºÄÏÊÐ| ÇàÁú| »¥Öú| ƽ²ýÏØ| »ÆÊ¯ÊÐ| ÎÚ³ľÆëÊÐ| ¾¸Î÷ÏØ| ÄÏÑôÊÐ| ÜõÍåÇø| ËìÆ½ÏØ| ±£É½ÊÐ| ÁéÇðÏØ| ÓñÃÅÊÐ| ÃàÑôÊÐ| ÒË´¨ÏØ| ¹Å½»ÊÐ| ÓÑÒêÏØ| ÍòÈÙÏØ| °²¼ªÏØ| ÆÕ¶¨ÏØ| ÆÕÀ¼µêÊÐ| вýÏØ|