001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ejb.plugins.cmp.jdbc.bridge;
023:
024: import java.sql.PreparedStatement;
025: import java.sql.ResultSet;
026:
027: import org.jboss.ejb.EntityEnterpriseContext;
028: import org.jboss.ejb.plugins.cmp.bridge.FieldBridge;
029: import org.jboss.ejb.plugins.cmp.jdbc.JDBCType;
030: import org.jboss.ejb.plugins.cmp.jdbc.JDBCEntityPersistenceStore;
031:
032: /**
033: * @author <a href="mailto:loubyansky@ua.fm">Alex Loubyansky and others</a>
034: */
035: public interface JDBCFieldBridge extends FieldBridge {
036: /** Gets the JDBC type of this field. */
037: public JDBCType getJDBCType();
038:
039: /**
040: * Is this field a member of the primary key.
041: * @return true if this field is a member of the primary key
042: */
043: public boolean isPrimaryKeyMember();
044:
045: /**
046: * Is this field read only.
047: * @return true if this field is read only
048: */
049: public boolean isReadOnly();
050:
051: /**
052: * Has current data read timed out?
053: */
054: public boolean isReadTimedOut(EntityEnterpriseContext ctx);
055:
056: /**
057: * Has the data been loaded?
058: */
059: public boolean isLoaded(EntityEnterpriseContext ctx);
060:
061: /**
062: * Set CMPFieldValue to Java default value (i.e., 0 or null).
063: */
064: public void initInstance(EntityEnterpriseContext ctx);
065:
066: /**
067: * Resets any persistence data maintained in the context.
068: */
069: public void resetPersistenceContext(EntityEnterpriseContext ctx);
070:
071: /**
072: * Sets the prepared statement parameters with the data from the
073: * instance associated with the context.
074: */
075: public int setInstanceParameters(PreparedStatement ps,
076: int parameterIndex, EntityEnterpriseContext ctx);
077:
078: /**
079: * Gets the internal value of this field without user level checks.
080: * @param ctx the context for which this field's value should be fetched
081: * @return the value of this field
082: */
083: public Object getInstanceValue(EntityEnterpriseContext ctx);
084:
085: /**
086: * Sets the internal value of this field without user level checks.
087: * @param ctx the context for which this field's value should be set
088: * @param value the new value of this field
089: */
090: public void setInstanceValue(EntityEnterpriseContext ctx,
091: Object value);
092:
093: /**
094: * Loads the data from result set into the instance associated with
095: * the specified context.
096: */
097: public int loadInstanceResults(ResultSet rs, int parameterIndex,
098: EntityEnterpriseContext ctx);
099:
100: /**
101: * Loads the value of this cmp field from result set into argument referance.
102: */
103: public int loadArgumentResults(ResultSet rs, int parameterIndex,
104: Object[] argumentRef);
105:
106: /**
107: * Has the value of this field changes since the last time clean was called.
108: */
109: public boolean isDirty(EntityEnterpriseContext ctx);
110:
111: /**
112: * Mark this field as clean.
113: */
114: public void setClean(EntityEnterpriseContext ctx);
115:
116: boolean isCMPField();
117:
118: JDBCEntityPersistenceStore getManager();
119:
120: Object getPrimaryKeyValue(Object arg);
121: }
|