📄 entriesdaosample.java
字号:
/*
*
* 开发时间:2004-08-20 at 05:40:07
*
* 作者:曹广鑫
*
* 网站:www.helpsoft.org 电子邮件:support@helpsoft.org
*/
package org.helpsoft.blog.example;
import java.math.*;
import java.util.Date;
import java.util.Collection;
import org.helpsoft.blog.dao.EntriesDao;
import org.helpsoft.blog.dto.Entries;
import org.helpsoft.blog.exceptions.EntriesDaoException;
import org.helpsoft.blog.factory.EntriesDaoFactory;
public class EntriesDaoSample
{
/**
* Method 'main'
*
* @param arg
* @throws Exception
*/
public static void main(String[] arg) throws Exception
{
// Uncomment one of the lines below to test the generated code
// findAll();
// findWhereEntryidEquals(0);
// findWhereNameEquals("");
// findWhereAuthorEquals("");
// findWhereDateEquals("");
}
/**
* Method 'findAll'
*
*/
public static void findAll()
{
try {
EntriesDao _dao = getEntriesDao();
Entries _result[] = _dao.findAll();
for (int i=0; i<_result.length; i++ ) {
display( _result[i] );
}
}
catch (Exception _e) {
_e.printStackTrace();
}
}
/**
* Method 'findWhereEntryidEquals'
*
* @param entryid
*/
public static void findWhereEntryidEquals(int entryid)
{
try {
EntriesDao _dao = getEntriesDao();
Entries _result[] = _dao.findWhereEntryidEquals(entryid);
for (int i=0; i<_result.length; i++ ) {
display( _result[i] );
}
}
catch (Exception _e) {
_e.printStackTrace();
}
}
/**
* Method 'findWhereNameEquals'
*
* @param name
*/
public static void findWhereNameEquals(String name)
{
try {
EntriesDao _dao = getEntriesDao();
Entries _result[] = _dao.findWhereNameEquals(name);
for (int i=0; i<_result.length; i++ ) {
display( _result[i] );
}
}
catch (Exception _e) {
_e.printStackTrace();
}
}
/**
* Method 'findWhereAuthorEquals'
*
* @param author
*/
public static void findWhereAuthorEquals(String author)
{
try {
EntriesDao _dao = getEntriesDao();
Entries _result[] = _dao.findWhereAuthorEquals(author);
for (int i=0; i<_result.length; i++ ) {
display( _result[i] );
}
}
catch (Exception _e) {
_e.printStackTrace();
}
}
/**
* Method 'findWhereDateEquals'
*
* @param date
*/
public static void findWhereDateEquals(String date)
{
try {
EntriesDao _dao = getEntriesDao();
Entries _result[] = _dao.findWhereDateEquals(date);
for (int i=0; i<_result.length; i++ ) {
display( _result[i] );
}
}
catch (Exception _e) {
_e.printStackTrace();
}
}
/**
* Method 'getEntriesDao'
*
* @return EntriesDao
*/
public static EntriesDao getEntriesDao()
{
return EntriesDaoFactory.create();
}
/**
* Method 'display'
*
* @param dto
*/
public static void display(Entries dto)
{
StringBuffer buf = new StringBuffer();
buf.append( dto.getEntryid() );
buf.append( ", " );
buf.append( dto.getName() );
buf.append( ", " );
buf.append( dto.getAuthor() );
buf.append( ", " );
buf.append( dto.getDate() );
buf.append( ", " );
buf.append( dto.getContent() );
System.out.println( buf.toString() );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -