web server - Borland Technical Publications
web server - Borland Technical Publications web server - Borland Technical Publications
Container-managed data access support Important Note Important You specify your own optimized SQL in the Borland proprietary deployment descriptor, ejb-borland.xml. The XML grammar is identical to that found in ejb-jar.xml, except that the element is replaced with a element. This proprietary element contains a SQL-92 statement (not an EJB-QL statement) that is used to access the database instead of the CMP engine-generated SQL. The SELECT clause for this statement must be identical to the SELECT clause generated by the Borland CMP engine. Subsequent clauses are user-optimized. The ordering of the fields in the SELECT clause is proprietary to the CMP engine and therefore must be preserved. For example: EmployeeBean ... findWealthyEmployees SELECT E.DEPT_NO, E.EMP_NO, E.FIRST_NAME, E.FULL_NAME, E.HIRE_DATE, E.JOB_CODE, E.JOB_COUNTRY, E.JOB_GRADE, E.LAST_NAME, E.PHONE_EXT, E.SALARY FROM EMPLOYEE E WHERE E.SALARY > 200000 ... The extensive SELECT statement reflects the type of SQL generated by the CMP engine. When the CMP engine encounters an EJB-QL statement in the ejb-jar.xml deployment descriptor, it checks ejb-borland.xml to see if there is any user SQL provided in the same bean's descriptor. If none is present, the CMP engine generates its own SQL and executes it. If the ejb-borland.xml descriptor does contain a query element, it uses the SQL within the tags instead. The element in ejb-borland.xml does not replace the element in the standard ejb-jar.xml deployment descriptor. If you want to override the CMP engine's SQL, you must provide the elements in both descriptors. Container-managed data access support For CMP, the Borland EJB Container supports all data types supported by the JDBC specification, including types beyond those supported by JDBC. The following table shows the basic and complex types supported by the Borland EJB Container: Basic types: boolean Boolean byte Byte char Character double Double float Float int Integer long Long short Short String java.sql.Date BigDecimal java.util.Date byte[] java.sql.Time java.sql.TimeStamp Chapter 17: EJB-QL and Data Access Support 159
Container-managed data access support Complex types: Any class implementing java.io.Serializable, such as Vector and Hashtable Other entity bean references Note The Borland CMP engine now supports using the Long value type for dates, as well as java.sql.Date for java.util.Date. Keep in mind that the Borland Container supports classes implementing the java.io.Serializable interface, such as Hashtable and Vector. The container supports other data types, such as Java collections or third party collections, because they also implement java.io.Serializable. For classes and data types that implement the Serializable interface, the Container merely serializes their state and stores the result into a BLOB. The Container does not do any “smart” mapping on these classes or types; it just stores the state in binary format. The Container's CMP engine observes the following rule: the engine serializes as a BLOB all types that are not one of the explicitly supported types. Depending on your database implementation, the following data types require fetching based on column index: Database Data Types Oracle ■ LONG RAW Sybase ■ NTEXT ■ IMAGE MS SQL ■ NTEXT ■ IMAGE Note If you use either of the two data types BINARY (MS SQL) or RAW (Oracle) as primary keys, you must explicitly specify their size. Support for Oracle Large Objects (LOBs) There are two types of Large Objects (LOBs), Binary Large Objects (BLOBs) and Character Large Objects (CLOBs). BLOBs are mapped to CMP fields with the following data types: ■ byte[] ■ java.io.Serializable ■ java.io.InputStream CLOBs, by virtue of being Character Large Objects, can only be mapped to cmp-fields with the java.lang.String data type. 160 BES Developer’s Guide
- Page 119 and 120: Sessions in secondary storage If yo
- Page 121 and 122: 110 BES Developer’s Guide
- Page 123 and 124: Container-managed persistence and R
- Page 125 and 126: Implementing an entity bean Generat
- Page 127 and 128: Container-Managed Persistence in Bo
- Page 129 and 130: Container-Managed Persistence in Bo
- Page 131 and 132: Setting Properties Setting Properti
- Page 133 and 134: Setting Properties into a BLOB. The
- Page 135 and 136: Setting Properties Automatic table
- Page 137 and 138: 126 BES Developer’s Guide
- Page 139 and 140: Container-managed persistence and R
- Page 141 and 142: Container-Managed Persistence in Bo
- Page 143 and 144: Container-Managed Persistence in Bo
- Page 145 and 146: Container-Managed Persistence in Bo
- Page 147 and 148: Container-Managed Persistence in Bo
- Page 149 and 150: Container-Managed Persistence in Bo
- Page 151 and 152: Container-Managed Persistence in Bo
- Page 153 and 154: 142 BES Developer’s Guide
- Page 155 and 156: Setting Properties J2EE 1.3 Entity
- Page 157 and 158: Setting Properties Figure 16.2 Edit
- Page 159 and 160: Setting Properties Table 16.1 ejb.m
- Page 161 and 162: Setting Properties Table 16.3 Table
- Page 163 and 164: Setting Properties Security Propert
- Page 165 and 166: Aggregate Functions in EJB-QL Selec
- Page 167 and 168: Support for ORDER BY Support for OR
- Page 169: Overriding SQL generated from EJB-Q
- Page 173 and 174: 162 BES Developer’s Guide
- Page 175 and 176: Generating primary keys from a cust
- Page 177 and 178: Implementing primary key generation
- Page 179 and 180: Transaction manager services Consis
- Page 181 and 182: Transaction manager services When t
- Page 183 and 184: Transaction manager services Follow
- Page 185 and 186: Declarative transaction management
- Page 187 and 188: Declarative transaction management
- Page 189 and 190: JDBC API Modifications JDBC API Mod
- Page 191 and 192: Handling of EJB exceptions Applicat
- Page 193 and 194: 182 BES Developer’s Guide
- Page 195 and 196: Client View of an MDB Client View o
- Page 197 and 198: Clustering of MDBs This is yet anot
- Page 199 and 200: Error Recovery Redelivered messages
- Page 201 and 202: 190 BES Developer’s Guide
- Page 203 and 204: JNDI Definitions Module Important s
- Page 205 and 206: Disabling and Enabling a Deployed D
- Page 207 and 208: Configuring JDBC Datasources In the
- Page 209 and 210: Configuring JDBC Datasources To add
- Page 211 and 212: Defining the Connection Pool Proper
- Page 213 and 214: Defining the Connection Pool Proper
- Page 215 and 216: Descriptions of Borland Enterprise
- Page 217 and 218: Advanced Topics for Defining JDBC D
- Page 219 and 220: Connecting to JDBC Resources from J
Container-managed data access support<br />
Complex types:<br />
Any class implementing java.io.Serializable, such as Vector and<br />
Hashtable<br />
Other entity bean references<br />
Note<br />
The <strong>Borland</strong> CMP engine now supports using the Long value type for dates, as well as<br />
java.sql.Date for java.util.Date.<br />
Keep in mind that the <strong>Borland</strong> Container supports classes implementing the<br />
java.io.Serializable interface, such as Hashtable and Vector. The container supports<br />
other data types, such as Java collections or third party collections, because they also<br />
implement java.io.Serializable. For classes and data types that implement the<br />
Serializable interface, the Container merely serializes their state and stores the result<br />
into a BLOB. The Container does not do any “smart” mapping on these classes or types;<br />
it just stores the state in binary format. The Container's CMP engine observes the<br />
following rule: the engine serializes as a BLOB all types that are not one of the explicitly<br />
supported types.<br />
Depending on your database implementation, the following data types require fetching<br />
based on column index:<br />
Database<br />
Data Types<br />
Oracle ■ LONG RAW<br />
Sybase ■ NTEXT<br />
■<br />
IMAGE<br />
MS SQL ■ NTEXT<br />
■<br />
IMAGE<br />
Note<br />
If you use either of the two data types BINARY (MS SQL) or RAW (Oracle) as primary keys,<br />
you must explicitly specify their size.<br />
Support for Oracle Large Objects (LOBs)<br />
There are two types of Large Objects (LOBs), Binary Large Objects (BLOBs) and<br />
Character Large Objects (CLOBs).<br />
BLOBs are mapped to CMP fields with the following data types:<br />
■<br />
byte[]<br />
■<br />
java.io.Serializable<br />
■<br />
java.io.InputStream<br />
CLOBs, by virtue of being Character Large Objects, can only be mapped to cmp-fields<br />
with the java.lang.String data type.<br />
160 BES Developer’s Guide