本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
1) The model has very general meanings. We may talk about the business model of a company. However, in the software development, patterns have very specific meaning. A pattern means a general solution that repeat in the different business contexts. For instance, the immutable pattern implies that once some objects are created, we cannnot modify their contents. You can see the immutable pattern in the String class and 8 wrapper classes. You cannot create an Integer as follows:
Integer i = new Integer(100);
and change its contents later by re-setting its encapsulated int value. No way! Remind: this unchangeabiliy exists in String, Integer, Boolean, ... but all these things are different. --So they share a pattern---immutable pattern.
2) EntityBeans are proxies of data in persistence( database). If you are not establishing the proxy in the EJB container for the data stored in the database, you are probably model the client activity and need use SessionBean. Generally, SessionBeans use EntityBeans. Sometimes, you may use your SessionBeans to access database directly and try to avoid use EntityBeans, say, for performance's sake.
更多精彩文章及讨论，请光临枫下论坛. 网址: rolia.net/zh