Class StoreUtil

java.lang.Object
com.groiss.store.StoreUtil

public class StoreUtil extends Object
Utilities for store
  • Field Details

  • Method Details

    • getNewInstance

      public static Persistent getNewInstance(Class<?> c)
      Create a new instance of c. c can be an interface, then mapInterface(Class) is used to determine the appropriate implementation class.
      Parameters:
      c - the class or interface
      Returns:
      an instance of c
    • getNewInstance

      public static Persistent getNewInstance(String className)
      Create a new instance of a class c specified via the className . c can be an interface, then mapInterface(String) is used to determine the appropriate implementation class.
      Parameters:
      className - the name of the class or interface
      Returns:
      an instance of c
    • base

      public static Persistent base(Persistent o)
      Return the base object of a Persistent o. If o ist an instance of View, its base object is returned, otherwise, o is returned.
      Parameters:
      o - the View Object
      Returns:
      the base object of o.
    • dbFields

      public static List<Field> dbFields(Persistent o)
      Returns the fields of the object which have corresponding fields in the database.
      Returns:
      a List containing the persistent fields of the class.
    • hasDbField

      public static boolean hasDbField(Class<?> c, String fieldName)
      Returns true, if the Class has a field with the given name which corresponds to a column in the database.
      Returns:
      true, if there is such a field
    • dbMultiValuedFields

      public static List<Field> dbMultiValuedFields(Persistent o)
      Returns the multivalued fields (Lists, Maps, Sets) of the object which have corresponding fields in the database.
      Returns:
      a List containing the persistent multivalued fields of the class.
    • cleanDbFieldV

      public static void cleanDbFieldV()
    • dbAttrs

      public static String dbAttrs(Persistent o, String prefix)
    • dbAttrsCount

      public static int dbAttrsCount(Persistent o)
    • dbAttrs

      public static String dbAttrs(Persistent o)
    • hasClassAttribute

      public static boolean hasClassAttribute(Class<?> c)
    • dbAttrPos

      public static int dbAttrPos(Persistent o, String fieldname)
    • setValues

      public static void setValues(Persistent o, Map<String,? extends Object> req)
    • setValues

      public static void setValues(Persistent o, Map<String,? extends Object> req, Map<String,Short> fieldmodes)
    • setValues2

      public static boolean setValues2(Persistent o, Map<String,? extends Object> req, Map<String,Short> fieldmodes, boolean dontLocalizeNumbers)
    • setNumber

      public static boolean setNumber(Persistent o, Field ff, String val, boolean dontLocalizeNumbers) throws Exception
      Set a field to a numeric value, the value is given as String.
      Parameters:
      o - the target object
      ff - the field which reveices the value
      val - the value
      dontLocalizeNumbers - if true, don't use the localized number formatter
      Returns:
      true if the field is numeric
      Throws:
      Exception
    • setFieldToValue

      public static void setFieldToValue(Persistent o, Field ff, Object val, Map<String,? extends Object> req) throws Exception
      Set a field of an object
      Parameters:
      o -
      ff -
      val -
      req -
      Throws:
      Exception
    • setFieldToValue

      public static boolean setFieldToValue(Persistent o, Field ff, Object value, Map<String,? extends Object> req, boolean dontLocalizeNumbers) throws Exception
      Set a field of an object
      Parameters:
      o - the object to fill
      ff - the object's field
      value - the value to assign
      req - all other values
      dontLocalizeNumbers - false if value may be in a locale-dependent format
      Throws:
      Exception
    • setFromRSByName

      public static void setFromRSByName(Persistent o, ResultSet rs) throws Exception
      Set the members of the persistent object to the corresponding values of the current row of the result set. The object is added to the Thread-Cache. The method uses a conventional metadata based approach to determine the position and data types of the fields of the ResultSet and is somewhat slower than setFromRS.
      Parameters:
      o - The persistent object
      rs - the ResultSet
      Throws:
      Exception
    • setFromRSByName

      public static void setFromRSByName(Persistent o, ResultSet rs, boolean addToCache) throws Exception
      Set the members of the persistent object to the corresponding values of the current row of the result set. The method uses a conventional metadata based approach to determine the position and data types of the fields of the ResultSet and is somewhat slower than setFromRS.
      Parameters:
      o - The persistent object
      rs - the ResultSet
      addToCache - if true, the object is added to the Thread-Cache.
      Throws:
      Exception
    • setFromRS

      public static void setFromRS(Persistent o, ResultSet rs) throws Exception
      Set the members of the persistent object to the corresponding values of the current row of the result set. The object is added to the Thread-Cache. The method uses a fast approach to determine the position and data types of the fields of the ResultSet.
      Parameters:
      o - The persistent object
      rs - the ResultSet
      Throws:
      Exception
    • setFromRS

      public static void setFromRS(Persistent o, ResultSet rs, boolean addToCache) throws Exception
      Set the members of the persistent object to the corresponding values of the current row of the result set. The method uses a fast approach to determine the position and data types of the fields of the ResultSet.
      Parameters:
      o - The persistent object
      rs - the ResultSet
      addToCache - if true, the object is added to the Thread-Cache.
      Throws:
      Exception
    • getFromRS

      public static Object getFromRS(ResultSet rs, ResultSetMetaData metaData, int i) throws Exception
      Throws:
      Exception
    • getFromRS

      public static Object getFromRS(ResultSet rs, int sqlType, int i) throws Exception
      Throws:
      Exception
    • getField

      public static Field getField(Persistent o, String fieldname)
    • toNative

      public static String toNative(String statements)
      Translate SQL Statements in to native form. Can also be used instead of the (removed) toNativeScript() method.
      Parameters:
      statements - the statement(s) in SQL, containing special tags for DBMS-dependent things
      Returns:
      the statements in native SQL
    • addEventHandler

      public static void addEventHandler(PersistentEventHandler<? extends Persistent> handler, Class<?>... classes)
      Add an event handler for the passed persistent classes. Each class must implement Persistent otherwise no registration for that class will be performed and an error will be logged (but no Exception will be thrown).

      The determination of applicable event handlers during read, insert, update and delete operations is done via the runtime class o.getClass() of the object o.

      In general, registrations for interfaces, abstract classes or superclasses will not work; there will be a log entry at level ERROR of the form "PersistentEventHandler <classname> is NOT being registered ..." in such a case.

      One exception from this general rule is if the interface can be mapped to a well defined single implementation class (i.e. if isSingleInterface(Class) returns true like for interface com.groiss.org.User).

      Another exception is the Persistent interface itself. Handlers registered for Persistent will be called for all objects implementing Persistent. Such handlers must decide themselves if they are applicable or not, e.g. by using if (o instanceof class/interface) {...}.

      Parameters:
      handler - the PersistentEventHandler to be called when instances of the classes are manipulated via the store.
      classes - the runtime classes for which the handler will be invoked.
    • removeEventHandler

      public static void removeEventHandler(PersistentEventHandler<?> handler)
      Remove a PersistentEventHandler. All handlers with the same class as handler get removed.
      Parameters:
      handler - an instance of the handlers to be removed
    • getEventHandlers

      public static <T extends Persistent> List<PersistentEventHandler<T>> getEventHandlers(Class<Persistent> c)
      Get a List of PersistentEventHandler for a specified class c.
      Parameters:
      c - the class
      Returns:
      a list of PersistentEventHandlers for c
    • getDate

      public static Date getDate(ResultSet rs, String columnName) throws SQLException
      Get a Date from a column of the current row of a ResultSet. Deals with DATE and TIMESTAMP SQL datatypes.
      Parameters:
      rs - the ResultSet
      columnName - the name of the column
      Returns:
      the date
      Throws:
      SQLException
    • getDate

      public static Date getDate(ResultSet rs, int columnIndex) throws SQLException
      Get a Date from a column of the current row of a ResultSet. Deals with DATE and TIMESTAMP SQL datatypes.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the date
      Throws:
      SQLException
    • getBigDecimal

      public static BigDecimal getBigDecimal(ResultSet rs, String columnName) throws SQLException
      Get a BigDecimal from a column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnName - the name of the column
      Returns:
      the BigDecimal
      Throws:
      SQLException
    • getBigDecimal

      public static BigDecimal getBigDecimal(ResultSet rs, int columnIndex) throws SQLException
      Get a BigDecimal from a column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the BigDecimal
      Throws:
      SQLException
    • setBigDecimal

      public static void setBigDecimal(PreparedStatement stmt, int pos, BigDecimal value) throws SQLException
      Get a parameter in a PreparedStatement from a BigDecimal. Masks differences in RDBMS implementations.
      Parameters:
      stmt - the PreparedStatement
      pos - the number of the parameter in the stmt
      value - the BigDecimal
      Throws:
      SQLException
    • getBigInteger

      public static BigInteger getBigInteger(ResultSet rs, String columnName) throws SQLException
      Get a BigInteger from a column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnName - the name of the column
      Returns:
      the BigInteger
      Throws:
      SQLException
    • getBigInteger

      public static BigInteger getBigInteger(ResultSet rs, int columnIndex) throws SQLException
      Get a BigInteger from a column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the BigInteger
      Throws:
      SQLException
    • setBigInteger

      public static void setBigInteger(PreparedStatement stmt, int pos, BigInteger value) throws SQLException
      Get a parameter in a PreparedStatement from a BigDecimal. Masks differences in RDBMS implementations.
      Parameters:
      stmt - the PreparedStatement
      pos - the number of the parameter in the stmt
      value - the BigDecimal
      Throws:
      SQLException
    • getClobBytes

      public static byte[] getClobBytes(ResultSet rs, int columnIndex) throws Exception
      Get a byte array from a Clob column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the byte[]
      Throws:
      SQLException
      Exception
    • getBlob

      public static byte[] getBlob(ResultSet rs, int columnIndex) throws Exception
      Get a byte array from a Blob column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the byte[]
      Throws:
      SQLException
      Exception
    • getClob

      public static String getClob(ResultSet rs, int columnIndex) throws Exception
      Get a String from a Clob column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the String
      Throws:
      SQLException
      Exception
    • getBlobString

      public static String getBlobString(ResultSet rs, int columnIndex) throws Exception
      Get a String from a Blob column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the String
      Throws:
      SQLException
      Exception
    • getBlobStream

      public static InputStream getBlobStream(ResultSet rs, int columnIndex) throws Exception
      Get a String from a Blob column of the current row of a ResultSet. Masks differences in RDBMS implementations.
      Parameters:
      rs - the ResultSet
      columnIndex - the index of the column
      Returns:
      the String
      Throws:
      SQLException
      Exception
    • prepareStatement

      public static PreparedStatement prepareStatement(String stmtText) throws SQLException
      Prepare a statement against the current connection The statement is also visible in the DBConnections overview. After finishing the statement, use stmtFinished() to let is disappear from this overview.
      Parameters:
      stmtText - the text of the SQL statement
      Returns:
      the PreparedStatement
      Throws:
      SQLException
    • stmtFinished

      public static void stmtFinished()
      Mark a statement (generated with prepareStatement(java.lang.String)) as finished.
    • setBindVars

      public static void setBindVars(PreparedStatement stmt, Object... bindVars)
      Set the bind variables of a prepared statement based on an object array.
      Parameters:
      stmt - the prepared statement
      bindVars - the list of bind variables, may contain Nil NullExpression and wrappers.
    • existsTable

      public static boolean existsTable(String tablename) throws Exception
      Returns true if the passed table exists in the current db-schema. The table name will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).

      Only ordinary tables (objects with type 'TABLE') are considered; objects with other types like 'SYNONYM' or 'SYSTEM TABLE' will not be found.

      Parameters:
      tablename - the name of the table to be checked.
      Returns:
      true if a table with the given name exists, else false
      Throws:
      Exception
    • canBeUsedForSelect

      public static boolean canBeUsedForSelect(String objectname)
      Returns true if the passed objectname exists in the database schema and can be used as select target. The object name will be transformed into proper case for the check (can be avoided by enclosing it in double quotes). Usually true for TABLEs, VIEWs, SYNONYMs, etc.
      Parameters:
      objectname - the name of the object
      Returns:
      true if the object can be used in a "select ... from objectname" statement, else false
    • existsView

      public static boolean existsView(String viewname) throws Exception
      Returns true if the passed view exists in the current db-schema. The view name will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).

      Only ordinary views (objects with type 'VIEW') are considered; objects with other types like 'SYNONYM' or 'MATERIALIZED VIEW' will not be found.

      Parameters:
      viewname - the name of the view to be checked.
      Returns:
      true if a view with the given name exists, else false
      Throws:
      Exception
    • existsSchemaObject

      public static boolean existsSchemaObject(String objectname, String objectType) throws Exception
      Returns true if the passed object exists in the current db-schema. The object name will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).
      Parameters:
      objectType - type of object (e.g "VIEW" or "TABLE") like returned from DatabaseMetaData.getTableTypes(), null returns all types of objects
      Returns:
      true if an object with the given name (and type) exists, else false
      Throws:
      Exception
    • existsColumn

      public static boolean existsColumn(String tablename, String columnname) throws Exception
      Returns true if the passed table/view exists in the current db-schema and the passed column exists in this table/view. The names will be transformed into proper case for the check (can be avoided by enclosing them in double quotes).
      Parameters:
      tablename - the name of the table/view to be checked.
      columnname - the name of the column to be checked.
      Returns:
      true if a the specified column exists in the specified table, else false
      Throws:
      Exception
    • getTableNames

      public static Set<String> getTableNames(String tableNamePattern) throws Exception
      Returns a set of names of tables conforming to the name pattern in the current db-schema. The table name pattern will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).

      Only ordinary tables (objects with type 'TABLE') are considered; objects with other types like 'SYNONYM' or 'SYSTEM TABLE' will not be found.

      Parameters:
      tableNamePattern - the pattern for the table names to match against.
      Returns:
      a set of names of tables
      Throws:
      Exception
    • getViewNames

      public static Set<String> getViewNames(String viewNamePattern) throws Exception
      Returns a set of names of views conforming to the name pattern in the current db-schema. The view name pattern will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).

      Only ordinary views (objects with type 'VIEW') are considered; objects with other types like 'SYNONYM' or 'MATERIALIZED VIEW' will not be found.

      Parameters:
      viewNamePattern - the pattern for the view names to match against.
      Returns:
      a set of names of views
      Throws:
      Exception
    • existsObject

      public static boolean existsObject(Set<String> objectNameSet, String name)
    • getObjectNames

      public static Set<String> getObjectNames(String namePattern, String objectType) throws Exception
      Returns a set of names of database objects (VIEWs/TABLEs/...) conforming to the name pattern in the current db-schema. The name pattern will be transformed into proper case for the check (can be avoided by enclosing it in double quotes).
      Parameters:
      namePattern - the pattern for the object names to match against.
      objectType - type of object (e.g "VIEW" or "TABLE") like returned from DatabaseMetaData.getTableTypes(), null returns all types of objects
      Returns:
      a set of names of objects
      Throws:
      Exception
    • getTableTypes

      public static List<String> getTableTypes() throws Exception
      Get the table types of the database. c.f. DatabaseMetaData.getTableTypes()
      Returns:
      the table types
      Throws:
      Exception
    • getExportedKeys

      public static List<List<Object>> getExportedKeys(String tablename) throws Exception
      Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).
      Parameters:
      tablename - the name of the table
      Returns:
      a list of rows. each row is a list of FK_NAME, FK_TABLENAME and FKCOLUMN_NAME
      Throws:
      Exception
    • existsConstraint

      public static boolean existsConstraint(String tablename, String constraintname) throws Exception
      Throws:
      Exception
    • getImportedKeys

      public static List<List<Object>> getImportedKeys(String tablename) throws Exception
      Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table).
      Parameters:
      tablename - the name of the table
      Returns:
      a list of rows. each row is a list of FK_NAME, FKCOLUMN_NAME, PKTABLE_NAME and PKCOLUMN_NAME
      Throws:
      Exception
    • existsIndex

      public static boolean existsIndex(String tablename, String indexname) throws Exception
      Returns true if the passed index exists in the current db-schema for the passed table. The names will be transformed into proper case for the check (can be avoided by enclosing them in double quotes).
      Parameters:
      indexname - the name of the index to be checked.
      tablename - the name of the table to be checked.
      Returns:
      true if a the specified index exists in the specified table, else false
      Throws:
      Exception
    • getIndexNameForColumns

      public static String getIndexNameForColumns(String tablename, String columns, boolean uniqueOnly) throws Exception
      Returns the name of the index, if one exists for the passed columns of the passed table. The names will be transformed into proper case for the check (can be avoided by enclosing them in double quotes).
      Parameters:
      columns - comma separated list of column names.
      tablename - the name of the table to be checked.
      uniqueOnly - when true, return only indices for unique values; when false, return indices regardless of whether unique or not
      Returns:
      the name of the index, if an index for the columns exists in the specified table, else null
      Throws:
      Exception
    • getIndexInfo

      public static Map<String,String> getIndexInfo(String tablename) throws Exception
      Throws:
      Exception
    • transformCase

      public static String transformCase(DatabaseMetaData dbmd, String id) throws Exception
      Throws:
      Exception
    • transformCase

      public static String transformCase(String id)
    • getMaxTableNameLength

      public static int getMaxTableNameLength()
    • getMaxConstraintIndexNameLength

      public static int getMaxConstraintIndexNameLength()
    • mapInterface

      public static <P> Class<Persistent> mapInterface(Class<P> c)
      Get the Persistent class which is implemented by the a Class c. e.g. maps com.groiss.org.User interface to the com.dec.avw.core.User class. If c is no such mappable interface, then c is returned (cast to a Persistent)
      Type Parameters:
      P -
      Parameters:
      c - interface to determine the underlying class for
      Returns:
      the mapped Persistent class
    • mapInterface

      public static Class<Persistent> mapInterface(String className) throws ClassNotFoundException
      Get the Persistent class which is implemented by a class with the given classname. e.g. maps User interface to the com.dec.avw.core.User class. If c is no such mappable interface, then an instance of the class named className is returned (cast to a Persistent)
      Parameters:
      className - the name of the interface to determine the underlying class for
      Returns:
      the mapped Persistent class
      Throws:
      ClassNotFoundException
    • mapInterfaceToClassName

      public static String mapInterfaceToClassName(String className)
      Get the name of the Persistent class which is implemented by a class with the given classname. e.g. maps User interface to the com.dec.avw.core.User class. If c is no such mappable interface, then className is returned.
      Parameters:
      className - the name of the interface to determine the underlying className for
      Returns:
      the mapped class name
    • isSingleInterface

      public static boolean isSingleInterface(Class<?> c)
      Determines if an interface c hides a single implementation (e.g. com.groiss.org.User covers com.dec.avw.core.User)
      Parameters:
      c - the interface to check
      Returns:
      true, if the is a single known implementation of c
    • mayBeReferenced

      public static boolean mayBeReferenced(String className) throws ClassNotFoundException
      Check, if for this class a foreign key can be defined.
      Parameters:
      className - name of a class
      Returns:
      Throws:
      ClassNotFoundException
    • executeScript

      public static void executeScript(String content, PrintWriter res) throws Exception
      Throws:
      Exception
    • executeScript

      public static void executeScript(String content, PrintWriter res, boolean tryAvoid) throws Exception
      Throws:
      Exception
    • executeSQLFile

      public static void executeSQLFile(String commands, PrintWriter res) throws Exception
      Throws:
      Exception
    • executeSQLFile

      public static int executeSQLFile(String commands, PrintWriter res, boolean tryAvoid) throws Exception
      Throws:
      Exception
    • getObject

      public static <T extends Persistent> T getObject(Object obj)
      Returns the Persistent, if obj is a string like: <classname>:<oid>
      Parameters:
      obj - A string like <classname>:<oid>.
      Returns:
      The matching Persistent
    • toString

      public static String toString(Persistent obj)
      Generates a String representation to identify a persistent object.
      Parameters:
      obj - the persistent object
      Returns:
      a String containing the class name of obj and its oid, separated by a colon
    • isSystemOid

      public static boolean isSystemOid(long oid)
      Returns true if the given oid is the oid of a system object (>0, <1000).
      Parameters:
      oid -
    • noNaN

      public static double noNaN(double d)
    • noNaN

      public static float noNaN(float f)
    • toEnum

      public static <T extends Enum<T>> T toEnum(Class<T> clazz, Object value)
      Maps a value to an instance of an Enum class
      Type Parameters:
      T - The resulting Enum Type
      Parameters:
      clazz - the enum Class
      value - the value to Map
      Returns:
      en Enum of the specified type with the corresponding value, or null When T extends DefinedEnum, the definedValue() is matched against, if not, Enum.name() is matched against (so then it is basically the same as Enum.valueOf(Class, String).
    • setFetchsize

      public static void setFetchsize(int rows)
    • getFetchSize

      public static int getFetchSize()
    • getDefaultStore

      @Deprecated(since="11.0", forRemoval=true) public static Store getDefaultStore()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns:
      a Store instance
    • getColumnDefinitions

      public static ResultSetMetaData getColumnDefinitions(Class<? extends Persistent> c, String selectList)
      Determine the ResultSetMetaData for columns of a Persistent class. Might not work for specific databases and / or JDBC drivers. In such a case, null will be returned.
      Parameters:
      c - the Persistent class
      selectList - the select list. If it is null or empty, then the dbAttrs(Persistent) is used to determine the select list. By using "*" for the select list, even transient attributes will be considered.
      Returns:
      the table definition as ResultSetMetaData
    • toJson

      public static JSONObject toJson(Persistent pers) throws Exception
      Convert a persistent to JSON. - Null values are written (JSONObect.NULL), - persistents are written as [toString(), classname:oid] - dates are written using getTime() as long
      Throws:
      Exception
    • createObjectFromJson

      public static Persistent createObjectFromJson(JSONObject job)
      Create a persistent object from a json object.
    • toMap

      public static Map<String,Object> toMap(Persistent pers) throws Exception
      Convert a persistent to a Map. - Null values are written (JSONObect.NULL), - persistents are written as JSONObject [toString(), classname:oid] - dates are written using getTime() as long
      Throws:
      Exception
    • toJsonAsReference

      public static JSONObject toJsonAsReference(Persistent pers)
    • toMapAsReference

      public static Map<String,Object> toMapAsReference(Persistent pers)
    • wrapSQLException

      public static ApplicationException wrapSQLException(int errNum, Throwable e)
      Wraps an exception ; tries to discriminate between sql constraint violations and other exceptions

      when sqlexception && sqlstate==23* ==> integrity constraint, (appex 478,e)

      when sqlexception && sqlstate!=23* ==> appex(errNum,e)

      when appex ==> appex

      otherwise: ==> new Appex(errNum,e)

      Parameters:
      errNum -
      e -
      Returns:
    • getDatabaseMetaData

      public static DatabaseMetaData getDatabaseMetaData() throws SQLException
      Retrieves a DatabaseMetaData object that contains metadata about the database to which the store is connected.
      Returns:
      a DatabaseMetaData object for this store (for the current connection)
      Throws:
      SQLException - if a database access error occurs
    • oidList

      public static List<String> oidList(List<?> l, int splitsize)
      Creates a list of strings of oids from a list of objects. If the objects are of type Persistent, indeed the oid will be used (as string) for the result, otherwise the toString() method will be used.
      Parameters:
      l - the list of objects
      splitsize - the maximum number of entries per list element (chunk size). If 0 is used, a suitable predefined size is being used.
      Returns:
      a list of Strings, each element of the list consists of maximal splitsize elements, separated by a comma
    • createExportKey

      public static String createExportKey(Persistent p) throws Exception
      Create a unique key for the object. If the class has a key defined, use it, otherwise use oid.
      Throws:
      Exception
    • checkDataLength

      public static void checkDataLength(Persistent o)
      Check the content of the fields of a persistent against the length constraint of the columns in the database. Only columns of type CHAR, VARCHAR and DECIMAL are taken in to account. Will throw an ApplicationException with number 1135 if violations would occur.
      Parameters:
      o - the persistent object to check