日期:2014-05-16  浏览次数:20524 次

【提问】对于自关联的表 使用dbunit如何保持数据库状态
比如区域,会有下级地市等等,对于dbunit来说他貌似只能对表与表之间的关联关系进行处理,对于同一表中记录与记录之间的关系,他处理不了,会出现外键约束违例。由于对dbunit目前了解的比较肤浅,还请大家能不吝赐教。
1 楼 long110 2007-05-17  
package com.javaeye.jms.jboss;  
  
import javax.jms.Connection;  
import javax.jms.ConnectionFactory;  
import javax.jms.Destination;  
import javax.jms.JMSException;  
import javax.jms.MessageConsumer;  
import javax.jms.MessageProducer;  
import javax.jms.Queue;  
import javax.jms.QueueSender;  
import javax.jms.Session;  
import javax.jms.TextMessage;  
import javax.naming.Context;  
import javax.naming.InitialContext;  
import javax.naming.NamingException;  
  
public class JbossNativeJmsImpl {  
     
    /** 
     * @author zuly 
     * 
     * following jms ptp domain, use an simple text message to test 
     * 
     * A jms ptp sender will following the steps below! 
     *     1> get an ConnectionFactory use JNDI Lookup Or Initial it yourself 
     *     2> use this ConnectionFactory to start a jms connection

     *        [spec to jms 1.1 apito get the main idea of it ] 
     *     3> use connection to create a jms session 
     *     4> get a queue destination / messege agent 
     *     5> start the Producer[jms1.1 spec] by a session 
     *     6> get messege Object or initial it yourself by implements the messegeor 

     *        it's sub interfaces 
     *     7> call sender or send it selfing 
     *     8> finallized the connection object or it will throw a warning to you! 
     * 
     * @param messege 
     * @throws NamingException 
     * @throws JMSException 
     */  
    public void sendingProcessing(String messege) throws NamingException, JMSException{  
        Context ctx = new InitialContext();  
        ConnectionFactory cf = (ConnectionFactory) ctx.lookup("java:JmsXA");  
        Connection conn = cf.createConnection();  
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);  
        Destination dest = (Queue) ctx.lookup("queue/A");  
        MessageProducer msgp = session.createProducer(dest);  
        QueueSender sender = (QueueSender) msgp;  
        TextMessage msg = session.createTextMessage();  
        msg.setText(messege);