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

📄 entitynonentitytest.java

📁 hibernate3.2.6源码和jar包
💻 JAVA
字号:
//$Id: EntityNonEntityTest.java 11282 2007-03-14 22:05:59Z epbernard $package org.hibernate.test.annotations.entitynonentity;import org.hibernate.Session;import org.hibernate.Transaction;import org.hibernate.test.annotations.TestCase;/** * @author Emmanuel Bernard */public class EntityNonEntityTest extends TestCase {	public void testMix() throws Exception {		GSM gsm = new GSM();		gsm.brand = "Sony";		gsm.frequency = 900;		gsm.isNumeric = true;		gsm.number = 2;		gsm.species = "human";		Session s = openSession();		Transaction tx = s.beginTransaction();		s.persist( gsm );		tx.commit();		s.clear();		tx = s.beginTransaction();		gsm = (GSM) s.get( GSM.class, gsm.id );		assertEquals( "top mapped superclass", 2, gsm.number );		assertNull( "non entity between mapped superclass and entity", gsm.species );		assertTrue( "mapped superclass under entity", gsm.isNumeric );		assertNull( "non entity under entity", gsm.brand );		assertEquals( "leaf entity", 900, gsm.frequency );		s.delete( gsm );		tx.commit();		s.close();	}	protected Class[] getMappings() {		return new Class[]{				Phone.class,				Voice.class,				GSM.class		};	}}

⌨️ 快捷键说明

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