Added: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd?rev=1872589&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd (added) +++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd Fri Jan 10 11:38:13 2020 @@ -0,0 +1,1157 @@ + + + + + + + + + +The XML schema used by version 4.1 and greater of the Apache Software +Foundation Torque project( +http://db.apache.org/torque ) +to model SQL database information. This model is used by various Torque +utilities for managing the SQL Server info and to build the Java objects +to access this data. + +The basic structure of a model is built using the database element +as the root. This will contain references to options, external (include) +models, new SQL Domain definitions, and tables. See the Torque project +home page for more details. + + + + + + + +The root element for defining a Torque database schema. + + + + + + + +The root type definition for a Torque database schema. + + + + + + +A set of key/value options to be passed to custom generator templates. + + + + + + + +Include another schema file in this schema (as if it were a part of this +schema file). + + + + + + +Reference another schema file from this schema (outbound connections only). + + + + + + +Domains are used to define common attribute sets for columns. + + + + + + +Defines a database table. + + + + + + +Defines a database view. + + + + + + + +The name used to identify this schema in the generated +Java objects and as the default JDBC connection pool to use. + + + + + + +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to primitive. + + + + + + +Defines the defaultIdMethod to use with tables which do not have an idMethod +attribute defined. This attribute has 3 possible values, they are: + +- idbroker + Torque's software based id broker system +- native + The SQL Server's native autoincrement/identifier process +- none + Don't try to auto assign id numbers +- null + Use the value previously set or the default value. + + + + + + + + + +These tags allows a set of key/value options to be passed to custom generator +templates. + + + + + + + + + + +Include another schema file in this schema (as if it were a part of this +schema file). + + + + + + + + + +Includes another schema file. + + + + + + + + + +Domains are used to define attributes for columns. + + + + + +The name used to reference this set of column attributes. + + + + + + +The SQL Standard data type for the column + + + + + + +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + + + + + + +The scale of the field. E.g.decimal(size, scale) + + + + + + +The default column value + + + + + + +The description of this domain for documentation purposes. + + + + + + + + + +The table element and its relevant attributes. + + + + + + + +The column element and its relevant attributes + + + + + + + +Define a foreign key constraint for this table. + + + + + + +Defines an index for this table. + + + + + + +Define a unique value constraint + + + + + + + + + + +The table name of the SQL table. + + + + + + +The interface attribute specifies an interface that should be referenced in +the implements section of the generated extension class. If this is a fully +qualified class name (i. e. the string contains dots), the interface will +simply be implemented by the extension object. If the interface is a simple +class name (without dots), an empty interface file will be generated in the +extension object package. When this attribute is used, all methods that +normally would return the extension object type will now return the interface +type. This feature allows to use Torque generated classes in the context of +other applications or APIs. + + + + + + +The interface attribute specifies an interface that should be referenced in +the implements section of the generated peer class. If this is a fully +qualified class name (i. e. the string contains dots), the interface will +simply be implemented by the peer object. If the interface is a simple +class name (without dots), an empty interface file will be generated in the +peer package. This feature allows to use Torque generated peer classes +in the context of other applications or APIs. + + + + + + +The fully qualified class that the generated Java table +record objects will extend. This class does not have to extend +org.apache.torque.om.BaseObject. + + + + + + +The fully qualified class that the generated Java Peer objects will extend. +Unlike baseClass, basePeer should extend BasePeer at some point in the chain, +i.e. it needs to be the superclass. + + + + + + +Defines the id method to automatically generate ids for this table. +This attribute has 3 possible values, they are: + +- idbroker + Torque's software based id broker system +- native + The SQL Server's native autoincrement / identifier process +- none + Don't try to auto assign id numbers + + + + + + +Whether or not to generate the class as Abstract or not + + + + + + +This is the Java class name to use when generating the table. If +this is missing the Java name is generated from the name attribute. + + + + + + +Whether or not to skip SQL generation for this reference. Useful for using +Views or creating a "subset" of columns in an existing table. + + + + + + +A description of this table. Used for documentation and will be included in +the table generation SQL if the server type supports this. + + + + + + + + + +The column element and its relevant attributes + + + + + + + + +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + + + + + + + + +The column name + + + + + + +The SQL data type for the column. Is required unless a domain is used. + + + + + + +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + + + + + + +The scale of the field. E.g.decimal(size, scale) + + + + + + +The default column value + + + + + + +Whether to use the database default value if a new object is saved +and the attribute value is equal to the java default value. Default is false. +Has no effect on primitive boolean columns. + + + + + + +Whether this column is part of the table's primary key. + + + + + + +Whether or not to auto-increment this field (true or false, defaults to false) + + + + + + +Whether a value is required in this column (NULL ALLOWED) (true or false, +defaults to false) + + + + + + +The Java property name to use for this column in the record objects. + + + + + + +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to database attribute or primitive + + + + + + +The domain reference name to set common settings. + + + + + + +The inheritance method used (see inheritance documentation) + + + + + + +If true, the setters and getters for this property will be protected rather +than public. + + + + + + +If true, this column is used as a version number for optimistic locking. +I.e. for updates, Torque will check that the version number in the database +is equal to the version number of the supplied object +and it will automatically increase the version number of the updated row. +Setting version to true will only work for numeric columns and will produce +code that does not compile if applied to other column types. + + + + + + +If this attribute has a value, the java type for the column is an enum. +The name of the enum type is contained in this attribute. It can be either +fully qualified or unqualified. + + + + + + +The description of this column for documentation purposes. + + + + + + + + + +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + + + + + +A value found in the column marked as the inheritance key column + + + + + + +The class name for the object that will inherit the record values + + + + + + +The class that the inheritor class will extend + + + + + + + + + +Defines a possible value for an enum. If any of these elements occurs +for a column, Torque will generate an enum for this column. + + + + + +The value for the enum. Must be unique. + + + + + + +The java name for the enum. Must be unique and must not clash +with automatically determined javaNames for the same enum. + + + + + + +A description for the enum value. + + + + + + + + + +Define a foreign key constraint for this table. + + + + + + + +Define a mapping between a local column containing a foreign key value and +the foreign table column. + + + + + + + +The name used to create the foreign key constraint. + + + + + + +The name of the table that contains the foreign key + + + + + + +The action to take when the referenced value in foreignTable is deleted. +Note this is handled by the database server and not Torque code. Will not +work if the DB server does not support this. + + + + + + +The action to take when the referenced value in foreignTable is updated. +Note this is handled by the database server and not Torque code. Will not +work if the DB server does not support this. + + + + + + + + + +Define a mapping between a local column containing a foreign key value and +the foreign table column. + + + + + +The column in the foreign table that contains the key. + + + + + + +The column in this table that contains the foreign key. + + + + + + + + + +Defines an index for this table. + + + + + + + +Define a column to use in a table index. + + + + + + + +The name used in creating this index in the database. + + + + + + + + + +Define a column to use in a table index. + + + + + +A column name to use in this index. Must exist in the table. + + + + + + + + + +Define a unique value constraint + + + + + + + +Specify a column to use in the unique constraint. + + + + + + + +The name to use in defining this constraint. + + + + + + + + + +Specify a column to use in the unique constraint. + + + + + +The name to use in defining this constraint. + + + + + + +The size of the field. E.g. columnname(size). Mainly to customize restrictions in bytes/character restrictions without global changes. + + + + + + + + + + + + + + + +The view element and its relevant attributes. + + + + + + + +The column element and its relevant attributes + + + + + + + +The name of the SQL view. + + + + + + +The fully qualified class that the generated Java view +record objects will extend. This class does not have to extend +org.apache.torque.om.BaseObject. + + + + + + +The fully qualified class that the generated Java Peer objects will extend. +Unlike baseClass, basePeer should extend BasePeer at some point in the chain, +i.e. it needs to be the superclass. + + + + + + +Whether or not to generate the class as Abstract or not + + + + + + +This is the Java class name to use when generating the view. If +this is missing the Java name is generated from the name attribute. + + + + + + +The remainder of the sql for the view after column definitions. + + + + + + +The complete SQL for creating the view. Overrides all other means +of generating the SQL for view creation. + + + + + + +Whether or not to skip SQL generation for this reference. + + + + + + +A description of this view. + + + + + + + + + +The column element and its relevant attributes + + + + + + + +Define an inheritance mapping of records to class by a key column. See the +inheritance How To document. + + + + + + + + +The column name + + + + + + +The SQL Standard data type for the column + + + + + + +The size of the field. E.g. Varchar(size) or Numeric(Size). Note that +while this still supports the original torque use of using a +decimal number (5.2) to indicate the precision +and scale in one attribute. Use of the scale attribute is preferred. + + + + + + +The scale of the field. E.g.decimal(size, scale) + + + + + + +The Java property name to use for this column in the record objects. + + + + + + +Defines if the record object property getter / setters will +use objects (e.g. Integer) or primitives (e.g. int), defaults +to database attribute or primitive + + + + + + +The domain reference name to set common settings. + + + + + + +The sql snippet which contains the value to select. + + + + + + +If true, the setters and getters for this property will be protected rather +than public. + + + + + + +The description of this column for documentation purposes. + + + + + + +If this attribute has a value, the java type for the column is an enum. +The name of the enum type is contained in this attribute. It can be either +fully qualified or unqualified. + + + + + + + + + +Standard SQL column data types. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +A schema type for methods to create ids automatically. + +idbroker = Torque's software based id broker system +native = The SQL Server's native method, depends on database used + (e.g. autoincrement for MySQL, sequence for postgresql...) +none = Don't try to auto assign id numbers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Java identifiers, e.g. [A-Za-z_$]A-Za-z_$0-9]* + + + + + + + + +Java fully qualified names (e.g. x.y.x) + + + + + + + + +SQL Standard non-delimited identifiers. + + + + + + + + +SQL Standard non-delimited identifiers. + + + + + + \ No newline at end of file Propchange: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/orm-reference/database-4-1.xsd ------------------------------------------------------------------------------ svn:eol-style = native Modified: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step1-ant.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step1-ant.xml?rev=1872589&r1=1872588&r2=1872589&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step1-ant.xml (original) +++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step1-ant.xml Fri Jan 10 11:38:13 2020 @@ -120,6 +120,31 @@ onerror="continue" src="target/generated-sql/bookstore-schema.sql"/> + + + + + Generating XML from JDBC connection with jars: ${antClasspath} ... + + + + + + + + + @@ -190,6 +215,16 @@ in the lib/ant directory of your project.
  • + Download the binary distribution of torque-generator-tasks. + Put the torque-generator-tasks-${version}.jar from its root directory + in the lib/ant directory of your project. + Copy the generator dependencies in direcotry lib from the source repo to lib/ant directory by running this command + mvn clean dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=libs -DexcludeScope=test) +
  • +
  • To configure Logging (Log4j2) set e.g. + set ANT_OPTS=-Dlog4j.configurationFile=lib/ant/log4j2.xml +
  • +
  • Download the appropriate mysql driver jar, e.g. from here and add the jar to the lib/ant directory of your project. Modified: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step2.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step2.xml?rev=1872589&r1=1872588&r2=1872589&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step2.xml (original) +++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step2.xml Fri Jan 10 11:38:13 2020 @@ -39,6 +39,33 @@ used to index these tables.

    +

    If you already hava a database set up you can generate a base schema with the + following command in your top-level project directory: +

    + + + + This will by default generate a schema.xml file. + By default or if you don not define defaultOutputDir it will be located in target/generated-schema. + + Hint: Copy the generated schema to src/main/schema directory and rename it to bookstore-schema.xml, + then add appropriate attributes e.g. +
  • defaultIdMethod to database element
  • +
  • autoIncrement attribute to columns
  • + + + ]]> + +

    +

    Your database schema file is typically located in the src/main/schema directory under the base of your project. @@ -220,9 +247,16 @@ Another common mistake is to forget that XML is case-sensitive. All of the elements and attributes must be specified according to either the +

  • 4.0 strict schema or default strict Schema XSD or the Schema XSD +
  • +
  • 4.1 strict schema or default + strict Schema XSD + or the + Schema XSD +
  • for the database schema. In addition, you should include the XML declaration and XML schema specification in your database schema file. @@ -232,7 +266,8 @@

    For additional information on the XML elements and attributes, please refer to the - Schema XSD. + Schema XSD + or 4.1 Schema XSD.

    Modified: db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step3-ant.xml URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step3-ant.xml?rev=1872589&r1=1872588&r2=1872589&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step3-ant.xml (original) +++ db/torque/torque4/trunk/torque-site/src/site/xdoc/documentation/tutorial/orm/step3-ant.xml Fri Jan 10 11:38:13 2020 @@ -72,6 +72,9 @@ ant generate ]]> + Hint: You have to create a build copy of your bookstore-schema.xml + named schema.xml in the sourceDir (by default src/main/schema) directory! +

    A successful build will be indicated by the BUILD SUCCESSFUL message. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org