- 浏览: 101087 次
-
文章分类
最新评论
-
jXee:
lgs0626 写道求源码,兄弟给共享下吧 "jee ...
jee6 学习笔记 4 - CRUD 2: View Details, Primefaces row selection -
lgs0626:
求源码,兄弟给共享下吧
jee6 学习笔记 4 - CRUD 2: View Details, Primefaces row selection
DAO interface.
DAO implemented as an EJB3.1 Stateless bean
小姐一下(本文不得不承认,windows中文输入很邪恶
):
1。 从EJB3.0开始,开发EJB已经非常方便了。不需要处理lifecycle,不需要进行讨厌的xml配置,利用annotation很容易。做个譬喻:都是土豆,但ejb2是带泥的土豆,而ejb3则不带泥了,洗巴的干干净净,多好。EJBs阿POJOs,测试起来也比较容易了吧。。。如果你测试上瘾的话, 哈哈。。。
2。 DI 很方便,死脑筋(spring)还有什么优势?真是三十年河东,又三十年河西。
3。 JPA在ORM架子上又抽象了一下,提供标准的API,这多舒坦啊,别再折腾XML了!
下一篇 CRUD 一下: jee6 学习笔记 4 - CRUD
package com.jxee.ejb; import javax.ejb.Local; import com.jxee.model.User; /** * although it's not required, it's good practice to define a DAO interface. * annotation @Local marks this as an EJB local interface. */ @Local public interface UserDAO { public User findUserByName(String username); }
DAO implemented as an EJB3.1 Stateless bean
package com.jxee.ejb; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import org.apache.log4j.Logger; import com.jxee.model.User; /** * annotation @Stateless marks a POJO as a stateless EJB and thus it * would have all the services available, like transaction management etc. */ @Stateless public class UserDAOImp implements UserDAO { private static final Logger log = Logger.getLogger(UserDAOImp.class); // inject the persistence unit to have access to database @PersistenceContext(unitName="punit.projee6") private EntityManager em; // @EJB AnotherEJB toInjectOtherEJB; /** * method throws runtime exception like "NoResultException" and * "NonUniqueResultException" etc, which you dont need to handle. * but you might want to handle it, such as "NoResultException". */ public User findUserByName(String username) { log.debug("finding user for name: " + username); String sql = "select u from User u where u.username = :username"; Query query = em.createQuery(sql); query.setParameter("username", username); return (User)query.getSingleResult(); // may throw runtime exceptions } }
小姐一下(本文不得不承认,windows中文输入很邪恶

1。 从EJB3.0开始,开发EJB已经非常方便了。不需要处理lifecycle,不需要进行讨厌的xml配置,利用annotation很容易。做个譬喻:都是土豆,但ejb2是带泥的土豆,而ejb3则不带泥了,洗巴的干干净净,多好。EJBs阿POJOs,测试起来也比较容易了吧。。。如果你测试上瘾的话, 哈哈。。。

2。 DI 很方便,死脑筋(spring)还有什么优势?真是三十年河东,又三十年河西。
3。 JPA在ORM架子上又抽象了一下,提供标准的API,这多舒坦啊,别再折腾XML了!
下一篇 CRUD 一下: jee6 学习笔记 4 - CRUD
发表评论
-
ActiveMQ and Spring JMS Framework Message Loss
2019-06-28 07:15 29Java Message Service (JMS) prov ... -
how to proxy to k8s web console
2018-06-28 07:16 589### how to access k8s web conso ... -
Call Stored Procedure with JPA 2.1
2018-06-27 10:57 691JPA 2.1 introduces APIs to call ... -
Send response and then process - async processing
2017-10-12 09:35 578If your request processing take ... -
java 8 time api test
2017-08-29 05:40 493public class ParseUtcDateTime ... -
Setup ApiKey in header with Swagger generated client code
2017-08-23 06:41 484@Value("${api.base.path} ... -
Simple tool to monitor jvm memory usage and garbage collection
2016-10-13 06:06 372JDK has built-in tool to moni ... -
Externalize Application Config properties with JBoss 7.1
2017-06-02 12:09 349If you have configuration pro ... -
JPA native query does not support setting list parameters
2014-03-27 06:45 1021you might want to do the ... -
Owning Side and Inverse Side of JPA entity relationships
2013-09-10 07:08 828Entity relationships may be b ... -
avoid setParameter for "order by" in JPQL
2013-03-07 05:55 790you might want to create a JP ... -
JPA Path Expression, operator IN and Collection properties
2013-01-23 16:25 1408If we want to select the Orde ... -
与JEE6/EJB3.1相比, Spring framework 丧失了几乎所有的优势
2013-01-19 13:13 1051The Spring framework was a ma ... -
Simple EasyMock tutorial
2012-12-20 11:57 699http://veerasundar.com/blog/20 ... -
Servlet 3.0 @WebFilter and @WebServlet
2012-12-04 07:09 2719Servlet 3.0 provides new annota ... -
Why JSF2 @ViewScoped not working?
2012-12-03 06:55 1388javax.faces.bean.ViewScoped sai ... -
When to configure an XA datasource?
2012-11-16 12:58 1275If you ever came across this wa ... -
java ee transaction and datasource concepts
2012-11-10 13:48 10581. What is a transaction? A tra ... -
pass params to primefaces confirmation dialog box
2012-09-28 19:30 1349<p:dataTable id="idStuD ... -
Handle Big Dataset with Real Pagination with Primefaces 3.3 LazyDataModel
2012-09-21 13:41 5648If you have millions of record ...
相关推荐
开发工具 eclipse-jee-mars-2-win32开发工具 eclipse-jee-mars-2-win32开发工具 eclipse-jee-mars-2-win32开发工具 eclipse-jee-mars-2-win32开发工具 eclipse-jee-mars-2-win32开发工具 eclipse-jee-mars-2-win32...
"eclipse-jee-oxygen-3-win32.rar" 是一个针对Windows 32位系统的Eclipse版本,专为Java企业级开发(JEE)设计。这个版本是Eclipse Oxygen系列的第三个发布版,它包含了众多开发者所需的工具和特性,旨在提升开发...
`@Asynchronous`是Java EE 6引入的EJB 3.1规范的一部分,它可以应用在无状态会话bean(Stateless Session Bean)的方法上。当一个带有`@Asynchronous`的方法被调用时,调用者会立即返回,而实际的方法执行将在另一...
无论是开发Servlet、JSP,还是处理EJB、JMS,或者是构建RESTful服务,Eclipse JEE Neon 3 都能提供完善的工具支持。 其次,Eclipse Neon系列的一大亮点在于其改进的用户界面和用户体验。Neon版本引入了更现代的设计...
"eclipse-jee-2023-09-R-linux-gtk-x86_64.tar.gz" 文件是Eclipse专为Java企业版(Java EE)开发者设计的2023年9月版本,适用于64位的Linux操作系统。这个版本包含了对Java EE开发所需的全部工具和功能,如Web服务器...
eclipse-jee-mars-1-win32-x86_64.7z eclipse-jee-mars-1-win32-x86_64.zip 我打的 7z 压缩包 关于有 Alt + / 不起作用解决办法: window -> General -> Keys -> Content Assist -> Binding: 改为 Alt + / When:...
在解压eclipse-jee-2022-06-R-win32-x86_64.zip后,我们会得到一个名为“eclipse”的文件夹,这个文件夹包含了整个IDE的所有组件和配置。启动Eclipse IDE,用户会看到熟悉的界面,包括工作区(Workspace)、透视图...
"eclipse-jee-neon-3-win32-x86_64"这个压缩包是针对Windows 64位系统的Eclipse版本,专为Java企业版(Java EE)开发设计。"JEE"代表Java Enterprise Edition,它包含了处理Web应用程序、分布式系统和企业级服务所需...
eclipse-jee-2021-12-R-win32-x86_64 eclipse-jee-2021-12-R-win32-x86_64 eclipse-jee-2021-12-R-win32-x86_64
eclipse-jee-2022-12-R-win32-x86_64,rar压缩包格式,解压即用。 安装教程:https://danbaku.blog.csdn.net/article/details/128600309
eclipse-jee-2023-12-R-win32-x86_64.zip 适用于Windows系统
eclipse-jee-neon-1a-win_64
eclipse-jee-neon-3-win32-x86_64共4给4个分卷 eclipse-jee-neon-3-win32-x86_64 eclipse-jee-neon-3-win32-x86_64.z01 eclipse-jee-neon-3-win32-x86_64.z02 eclipse-jee-neon-3-win32-x86_64.z03
eclipse-jee-oxygen-R-win32.7z.003
在Eclipse JEE版本中,这些功能得到了进一步增强,特别是对于Java EE应用程序的开发,如Web服务、Java服务器页面(JSP)、JavaServer Faces(JSF)以及Enterprise JavaBeans(EJB)等,提供了全面的工具集和模板。...
标题 "eclipse-jee-2018-09-win32-x86_64.zip" 提供的信息表明这是一款针对Java企业级开发的Eclipse集成开发环境(IDE)的2018年9月版本,适用于Windows 32位操作系统、x86_64架构的计算机。Eclipse是一个开源的、跨...
标题中的“eclipse-jee-2020-09-R-win32-x86_64.zip”指的是Eclipse IDE for Java EE Developers的2020年9月版本,适用于Windows 32位和64位系统的安装包。Eclipse是一款著名的开源集成开发环境(IDE),广泛用于...
"eclipse-jee-2023-09-R-win32-x86_64.zip" 是Eclipse针对2023年9月发布的一个更新版,专为Windows 64位操作系统设计。 在Windows系统上安装和使用Eclipse-JEE,你需要了解以下关键知识点: 1. **安装步骤**: - ...
eclipse-jee-neon-3-win32共4给4个分卷 eeclipse-jee-neon-3-win32 eclipse-jee-neon-3-win32.z01 eclipse-jee-neon-3-win32.z02 eclipse-jee-neon-3-win32.z03
Eclipse IDE for Enterprise Java and Web Developers (eclipse-jee-2021-12-R-win32-x86_64.zip)适用于Windwos x86_64