⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test5.java

📁 struts+hibernate BBS mysql数据库 功能基本齐全
💻 JAVA
字号:
package com.elan.forum.test;

import java.util.Iterator;
import java.util.List;

import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.elan.db.ElHbnDB;
import com.elan.forum.elf.El;
import com.elan.forum.model.ForumTopic;
import com.elan.forum.model.view.Forumnewtopic;
import com.elan.forum.model.view.ForumnewtopicId;

public class Test5 {

	public static void main(String[] args) throws Exception {
		Session session = ElHbnDB.getSession();
		Transaction tx = session.beginTransaction();
		try {
			ForumTopic ft = (ForumTopic)session.createQuery("from ForumTopic where id = 2").list().get(0);
			tx.commit();
			System.out.println(ft.getPiece().getName());
		} catch (Exception re) {
			tx.rollback();
		} finally {
			ElHbnDB.closeSession();
		}
		
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -