Skip to content

Instantly share code, notes, and snippets.

@ndzj081221130
Created March 8, 2014 01:50
Show Gist options
  • Select an option

  • Save ndzj081221130/9424011 to your computer and use it in GitHub Desktop.

Select an option

Save ndzj081221130/9424011 to your computer and use it in GitHub Desktop.
2014_2_28_EntityBean
In EJB 3.0, entity beans primarily serve as a persistence data model. They do not provide remote services. Hence, the entity bean clustering service in EJB 3.0 primarily deals with distributed caching and replication, instead of load balancing.
实体Bean不考虑LB,而是考虑分布式缓存和复制。
JBoss EJB 3.0 entity beans are implemented by Hibernate, which has support for a second-level cache. The second- level cache provides the following functionalities:
• Ifyoupersistacache-enabledentitybeaninstancetothedatabaseviatheentitymanager,the entity will be inserted into the cache.
• If you update an entity bean instance, and save the changes to the database via the entity manager, the entity will be updated in the cache.
• Ifyouremoveanentitybeaninstancefromthedatabaseviatheentitymanager,theentitywill be removed from the cache.
• If loading a cached entity from the database via the entity manager, and that entity does not exist in the database, it will be inserted into the cache.
prop.setProperty("java.naming.provider.url", "192.168.70.104:1099,192.168.45.146:1099");
创建两个数据库,node1使用account,node2使用test。
实验发现,第一次插入的数据同步了。
但是第二次插入的数据没有同步。
why?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment