`
eastPoint
  • 浏览: 53431 次
  • 性别: Icon_minigender_1
  • 来自: 湖北武汉
社区版块
存档分类
最新评论

Using the Hibernate API directly in DAO implementations

阅读更多
java 代码
  1. public class ProductDaoImpl extends HibernateDaoSupport implements ProductDao {   
  2.   
  3.      public Collection loadProductsByCategory(String category) throws MyException {   
  4.         Session session = getSession(getSessionFactory(), false);   
  5.          try {   
  6.              List result = session.find(   
  7.                  "from test.Product product where product.category=?",   
  8.                  category, Hibernate.STRING);   
  9.              if (result == null) {   
  10.                  throw new MyException("invalid search result");   
  11.              }   
  12.              return result;   
  13.          }   
  14.          catch (HibernateException ex) {   
  15.              throw convertHibernateAccessException(ex);   
  16.          }   
  17.      }   
  18. }  
分享到:
评论

相关推荐

    Practical API Architecture and Development with Azure and AWS

    Learn the business and technical importance of API design and architecture using the available cloud services from Azure and AWS. This book starts off with an introduction to APIs and the concept ...

    Programming Environments Manual for 32-Bit Implementations of the PowerPC™ Architecture

    It provides detailed information necessary for implementing the PowerPC architecture in various systems while also outlining the limitations and responsibilities associated with using the document ...

    ASP.NET.Web.API.2.Beginner.Guide

    This is a starter guide for those who want to quickly understand the basics of Web API. Topics covered in this book are: Implementing Web API Web API Client Implementations – ASP.NET MVC and jQuery...

    GSS-API Programming Guide 离线包

    Although the GSS-API enables applications control over security aspects, a programmer using GSS-API can write a program that is ignorant of the details of protecting network data. Therefore, a ...

    advanced programming in the unix(r) environment

    Stephen Rago's update is a long overdue benefit to the community of professionals using the versatile family of UNIX and UNIX-like operating environments. It removes obsolescence and includes newer ...

    FPGA implementations of neural networks

    During the 1980s and early 1990s there was significant work in the design and implementation of hardware neurocomputers. Nevertheless, most of these efforts may be judged to have been unsuccessful: at...

    Decoupled Drupal in Practice

    From there, the book explores the core and contributed landscape for decoupled Drupal, authentication mechanisms, and the surrounding tooling ecosystem before delving into consumer implementations in ...

    Matrix Algorithms in MATLAB

    Provides algorithms covered in three parts, the mathematical development of the algorithm using a simple example, the code implementation, and then numerical examples using the code Allows readers to ...

    jdk 10 api

    The Java Development Kit (JDK) APIs are specific to the JDK and will not necessarily be available in all implementations of the Java SE Platform. These APIs are in modules whose names start with jdk. ...

    javafx-8u152-apidocs-api

    The JavaFX runtime does the following, in order, whenever an application is launched: Constructs an instance of the specified Application class Calls the init() method Calls the start(javafx.stage....

    Data Structures and Algorithms Using Python

    Necaise introduces the basic array structure and explores the fundamentals of implementing and using multi-dimensional arrays. The underlying mechanisms of many of Python’s built-in data structures ...

    TCP-IP Sockets in Java. Practical Guide for Programmers

    The API (application programming interface) reference sections in each chapter, which describe the relevant parts of each class, have been replaced with (i) a summary section that lists the classes ...

    javaee API

    javax.activation The JavaBeans(TM) Activation Framework is used by the JavaMail(TM) API to manage MIME data. javax.annotation javax.annotation.security javax.ejb The javax.ejb package contains the ...

Global site tag (gtag.js) - Google Analytics