User: mgroot
Date: 01/01/16 13:25:12
Modified: src/main/org/jboss/ejb/plugins/jaws/jdbc
JDBCInitCommand.java
Log:
Added 'created table' log message
Added 'CONSTRAINT PRIMARY KEY' on the primary key, which is
useful information for some databases and dbase editors.
Revision Changes Path
1.10 +15 -2
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCInitCommand.java
Index: JDBCInitCommand.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCInitCommand.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JDBCInitCommand.java 2000/12/07 15:44:37 1.9
+++ JDBCInitCommand.java 2001/01/16 21:25:12 1.10
@@ -28,7 +28,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Joe Shevland</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Justin Forder</a>
- * @version $Revision: 1.9 $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Michel de Groot</a>
+ * @version $Revision: 1.10 $
*/
public class JDBCInitCommand
extends JDBCUpdateCommand
@@ -51,7 +52,13 @@
sql += (first ? "" : ",") +
cmpField.getColumnName() + " " +
- cmpField.getSQLType();
+ cmpField.getSQLType() +
+ // If the current field is the primary key field,
+ // add the constraint that this field is primary key.
+ // This is useful for some dbase editors like MS Access 97
+ // that require this information for better editing.
+ (jawsEntity.getPrimKeyField().equals(cmpField.getColumnName())?
+ " CONSTRAINT pk"+jawsEntity.getTableName()+" PRIMARY KEY":"");
first = false;
}
@@ -100,10 +107,16 @@
} else {
try
{
+
// since we use the pools, we have to do this within a transaction
factory.getContainer().getTransactionManager().begin ();
jdbcExecute(null);
factory.getContainer().getTransactionManager().commit ();
+
+ // Create successful, log this
+ log.log("Created table '"+jawsEntity.getTableName()+"'
successfully.");
+ log.debug("Primary key of table '"+jawsEntity.getTableName()+"'
is '"
+ +jawsEntity.getPrimKeyField()+"'.");
} catch (Exception e)
{
log.debug("Could not create table " +