Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
TypeDAO.java.svn-base
Package: cindyblog.rar [view]
Upload User: cdpainuo
Upload Date: 2022-07-12
Package Size: 5257k
Code Size: 1k
Category:
Jsp/Servlet
Development Platform:
Java
- package com.appspot.cindyblog.dao;
- import javax.persistence.EntityManager;
- import javax.persistence.Query;
- import com.appspot.cindyblog.pojo.TypeBean;
- public class TypeDAO extends BaseDAO{
- public boolean addTypeCount(String typeName,EntityManager em) {
- boolean b = false;
- try {
- String queryString = "SELECT FROM "+TypeBean.class.getName()+" WHERE name =:typeName";
- Query query = em.createQuery(queryString);
- query.setParameter("typeName", typeName);
- TypeBean type = (TypeBean) query.getSingleResult();
- int count = type.getTypeCount()+1;
- type.setTypeCount(count);
- b = true;
- }catch(Exception ex){
- ex.printStackTrace();
- } finally {
- return b;
- }
- }
- public boolean updateType(TypeBean o,EntityManager em) {
- boolean b = false;
- try {
- TypeBean f = em.find(TypeBean.class, o.getId());
- f.setName(o.getName());
- f.setTypeCount(o.getTypeCount());
- b = true;
- }catch(Exception ex){
- ex.printStackTrace();
- } finally {
- em.flush();
- return b;
- }
- }
- }