You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2012/07/26 02:19:22 UTC
svn commit: r1365852 -
/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml
Author: tfischer
Date: Thu Jul 26 00:19:22 2012
New Revision: 1365852
URL: http://svn.apache.org/viewvc?rev=1365852&view=rev
Log:
improved default values documentation
Modified:
db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml
Modified: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml?rev=1365852&r1=1365851&r2=1365852&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml (original)
+++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/modules/templates/specialFeatures.xml Thu Jul 26 00:19:22 2012
@@ -25,7 +25,22 @@
</properties>
<body>
- <section name="Date Default values">
+ <section name="Default values">
+ <p>
+ If a default is specified, the default value is used on both a new java object
+ and as column default value in the sql script for the database.
+ However, when a java object is saved, the database value is always
+ overwritten because the normal behavior for saving a new object
+ is to write all fields.
+ This behavior can be overwritten by setting the column attribute
+ useDatabaseDefaultValue to true. In this case, the column is not
+ written on inserts if the value of the corresponding java field
+ is equal to the default.<br/>
+ It is a good idea to have a non-primary key field in each table where
+ useDatabaseDefaultValue is not set because otherwise you could run into
+ SQL syntax errors when an unchanged new object is changed
+ (because there are no values to insert).
+ </p>
<p>
One can use CURRENT_DATE, CURRENT_TIME and CURRENT_TIMESTAMP
as default for Date fields.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org