FileDocCategorySizeDatePackage
CabinBean.javaAPI DocExample2926Sat Nov 24 13:59:28 GMT 2001com.titan.cabin

CabinBean

public abstract class CabinBean extends Object implements javax.ejb.EntityBean

Fields Summary
Constructors Summary
Methods Summary
public voidejbActivate()

        // Not implemented.
    
public java.lang.IntegerejbCreate(java.lang.Integer id)

	     Connection conn = null;
	    Statement stmt = null;
	    ResultSet rs = null;
	    boolean rowspresent = false;
	    String jdbcClass = "COM.cloudscape.core.RmiJdbcDriver";
	    String jdbcURL	 = "jdbc:cloudscape:rmi:TitanDB";
	    String user		 = "scott";
	    String password	 = "tiger";
	    int sequenceID = 0;
	    Integer myId = null;
	    
	    try
	    {
	        
		    InitialContext aContext = new InitialContext();
		    javax.sql.DataSource aDatasource = (javax.sql.DataSource)aContext.lookup("jdbc/Titan");
		    conn = aDatasource.getConnection();
		    System.out.println("Obtained a database connection to Cloudscape");
    		
		    stmt = conn.createStatement();
		    StringBuffer aString = new StringBuffer();
		    aString.append("select ").append("\"").append("CurrentValue");
		    aString.append("\"").append(" from ").append("\"").append("SequenceTable");
		    aString.append("\"").append(" where").append("\"").append("SequenceName");
		    aString.append("\"").append("like").append("'Cabin'").append(" for Update");
		    System.out.println(aString);
		    rs = stmt.executeQuery(aString.toString());
	        if (rs != null)
	        {
	            while (rs.next())
	            {
	                sequenceID =rs.getInt(1);
	            }
	        }
    	    
		    myId = new Integer(sequenceID);
		    sequenceID++;
		    StringBuffer aString2 = new StringBuffer("update \"SequenceTable\" set \"CurrentValue\"="+sequenceID+" where \"SequenceName\"='Cabin'");
		    System.out.println(aString2);
		    stmt.execute(aString2.toString());
		}
		catch( Exception ex)
		{
		    ex.printStackTrace();
		}
		this.setId(myId);
		return myId;
	
public voidejbLoad()

        // Not implemented.
    
public voidejbPassivate()

        // Not implemented.
    
public voidejbPostCreate(java.lang.Integer id)

		
	
public voidejbRemove()

        // Not implemented.
    
public voidejbStore()

        // Not implemented.
    
public abstract intgetBedCount()

public abstract intgetDeckLevel()

public abstract java.lang.IntegergetId()

public abstract java.lang.StringgetName()

public abstract intgetShipId()

public abstract voidsetBedCount(int count)

public abstract voidsetDeckLevel(int level)

public voidsetEntityContext(javax.ejb.EntityContext ctx)

         // Not implemented.
    
public abstract voidsetId(java.lang.Integer id)

public abstract voidsetName(java.lang.String name)

public abstract voidsetShipId(int ship)

public voidunsetEntityContext()

         // Not implemented.