<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--

  Copyright 2010, 2011 <NAME>

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

 -->
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

	<properties>
		<title>Usertype - Manual</title>
		<author><NAME></author>
	</properties>
	
	<body>

		<section name="Introduction">
			<p>Usertype can persist both JSR 310 and Joda Time based dates and times to a database using
				Hibernate.</p>
			<p>This project lets early adopters of JSR 310 also make use of
				Hibernate and for users of Joda Time provides a forward migration path</p>

			<subsection name="Documentation">
				<p>
					It is fairly easy to use this package with Hibernate. You can use
					either
					classic Hibernate mappings (hbm) or Annotations (i.e. JPA)
				</p>
			</subsection>
			<subsection name="Hibernate Mapping">
				<p>
					Use the <code>type</code> attribute with your property configuration. e.g.:
				</p>
				<pre><![CDATA[
<property type="org.jadira.usertype.dateandtime.joda.PersistentDateTime" name="dateTime"/>
		]]></pre>
				<p>or</p>
				<pre><![CDATA[
<property type="org.jadira.usertype.dateandtime.threetenbp.PersistentDateTime" name="dateTime"/>
		]]></pre>
			</subsection>

			<subsection name="Hibernate Annotations">
				<p>
					Use the <code>@org.hibernate.annotations.Type</code> annotation. e.g.:
				</p>
				<pre><![CDATA[
@Column
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
private LocalDateTime dateTime;
		]]></pre>
				<p>
					Some of the types require more than one column to be specified, as with
					<code>PersistentOffsetDateTime</code>:
				</p>
				<pre><![CDATA[
@Columns(columns={@Column(name="dateTime"),@Column(name="offset")})
@Type(type="org.jadira.usertype.dateandtime.threetenbp.PersistentOffsetDateTime")
private OffsetDateTime startDateTime;
		]]></pre>
			</subsection>
			
			<subsection name="Temporal Types">
				<p>
					Temporal types supported by Jadira include JSR 310 with Java 8, ThreeTen Backport,
					Joda Time and the legacy JDK Date and Time types. The support for Java 8 temporal
					types does not use setObject currently, so it does not require a JDBC 4.2 driver.
				</p>
			</subsection>
			
			<subsection name="Types Qualified by a Zone">
				<p>
					Many types have a logical zone associated with them. Jadira makes it possible
					to configure what zone you want to use when you inflate these types from the 
					database, and also what zone to use. You do this by setting parameters on the
					type. Consult the Javadoc for individual types
					to review the available options. For most types, Jadira defaults to using UTC
					in the database, and the JVM zone in the application. The following gives an example
					of setting the zone for PersistentDateTime:
				</p>
				<pre><![CDATA[
@Column
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime",
	parameters = { @Parameter(name = "databaseZone", value = "UTC"),
         @Parameter(name = "javaZone", value = "jvm")})
private DateTime dateTime;
					]]></pre>
			</subsection>

			<subsection name="Money Types">
				<p>
					Money Types typically consist of a currency and amount. Jadira makes it possible to 
					store only the amount to the database with the currency configured using a parameter.
					For example:
				</p>
				<pre><![CDATA[
@Column
@Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmount",
	parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "USD")})
private DateTime dateTime;
					]]></pre>
				<p>
					Alternatively, with other types two columns to hold the amount an currency:
				</p>
				<pre><![CDATA[
@Columns(columns = { @Column(name = "MY_CURRENCY"), @Column(name = "MY_AMOUNT") })
@Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmountAndCurrency")
private DateTime dateTime;
					]]></pre>
			</subsection>
			
			<subsection name="JDK Enums">
				<p>
					Jadira provides PersistentEnum that can map any arbitray enum. The following gives an example:
				</p>
				<pre><![CDATA[
@Columns(columns = { @Column(name = "MY_CURRENCY"), @Column(name = "MY_AMOUNT") })
@Type(type = "org.jadira.usertype.corejava.PersistentEnum",
	parameters = {@Parameter(name = "enumClass", value = "my.EnumType"),
	{@Parameter(name = "identifierMethod", value = "name"),
	{@Parameter(name = "valueOfMethod", value = "valueOf")})<commit_msg>Updated userguide examples to correct wrong type. Fixes #60<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--

  Copyright 2010, 2011 <NAME>

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

 -->
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">

	<properties>
		<title>Usertype - Manual</title>
		<author><NAME></author>
	</properties>
	
	<body>

		<section name="Introduction">
			<p>Usertype can persist both JSR 310 and Joda Time based dates and times to a database using
				Hibernate.</p>
			<p>This project lets early adopters of JSR 310 also make use of
				Hibernate and for users of Joda Time provides a forward migration path</p>

			<subsection name="Documentation">
				<p>
					It is fairly easy to use this package with Hibernate. You can use
					either
					classic Hibernate mappings (hbm) or Annotations (i.e. JPA)
				</p>
			</subsection>
			<subsection name="Hibernate Mapping">
				<p>
					Use the <code>type</code> attribute with your property configuration. e.g.:
				</p>
				<pre><![CDATA[
<property type="org.jadira.usertype.dateandtime.joda.PersistentDateTime" name="dateTime"/>
		]]></pre>
				<p>or</p>
				<pre><![CDATA[
<property type="org.jadira.usertype.dateandtime.threetenbp.PersistentDateTime" name="dateTime"/>
		]]></pre>
			</subsection>

			<subsection name="Hibernate Annotations">
				<p>
					Use the <code>@org.hibernate.annotations.Type</code> annotation. e.g.:
				</p>
				<pre><![CDATA[
@Column
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
private LocalDateTime dateTime;
		]]></pre>
				<p>
					Some of the types require more than one column to be specified, as with
					<code>PersistentOffsetDateTime</code>:
				</p>
				<pre><![CDATA[
@Columns(columns={@Column(name="dateTime"),@Column(name="offset")})
@Type(type="org.jadira.usertype.dateandtime.threetenbp.PersistentOffsetDateTime")
private OffsetDateTime startDateTime;
		]]></pre>
			</subsection>
			
			<subsection name="Temporal Types">
				<p>
					Temporal types supported by Jadira include JSR 310 with Java 8, ThreeTen Backport,
					Joda Time and the legacy JDK Date and Time types. The support for Java 8 temporal
					types does not use setObject currently, so it does not require a JDBC 4.2 driver.
				</p>
			</subsection>
			
			<subsection name="Types Qualified by a Zone">
				<p>
					Many types have a logical zone associated with them. Jadira makes it possible
					to configure what zone you want to use when you inflate these types from the 
					database, and also what zone to use. You do this by setting parameters on the
					type. Consult the Javadoc for individual types
					to review the available options. For most types, Jadira defaults to using UTC
					in the database, and the JVM zone in the application. The following gives an example
					of setting the zone for PersistentDateTime:
				</p>
				<pre><![CDATA[
@Column
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentDateTime",
	parameters = { @Parameter(name = "databaseZone", value = "UTC"),
         @Parameter(name = "javaZone", value = "jvm")})
private DateTime dateTime;
					]]></pre>
			</subsection>

			<subsection name="Money Types">
				<p>
					Money Types typically consist of a currency and amount. Jadira makes it possible to 
					store only the amount to the database with the currency configured using a parameter.
					For example:
				</p>
				<pre><![CDATA[
@Column
@Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmount",
	parameters = {@org.hibernate.annotations.Parameter(name = "currencyCode", value = "USD")})
private Money moneyAmount;
					]]></pre>
				<p>
					Alternatively, with other types two columns to hold the amount an currency:
				</p>
				<pre><![CDATA[
@Columns(columns = { @Column(name = "MY_CURRENCY"), @Column(name = "MY_AMOUNT") })
@Type(type = "org.jadira.usertype.moneyandcurrency.joda.PersistentMoneyAmountAndCurrency")
private Money moneyAmount;
					]]></pre>
			</subsection>
			
			<subsection name="JDK Enums">
				<p>
					Jadira provides PersistentEnum that can map any arbitray enum. The following gives an example:
				</p>
				<pre><![CDATA[
@Columns(columns = { @Column(name = "MY_CURRENCY"), @Column(name = "MY_AMOUNT") })
@Type(type = "org.jadira.usertype.corejava.PersistentEnum",
	parameters = {@Parameter(name = "enumClass", value = "my.EnumType"),
	{@Parameter(name = "identifierMethod", value = "name"),
	{@Parameter(name = "valueOfMethod", value = "valueOf")})
{'fraction_non_alphanumeric': 0.12165592657684046, 'fraction_numerical': 0.007810974419058777, 'mean_word_length': 3.8179680150517403, 'pattern_counts': {'":': 0, '<': 165, '<?xml version=': 2, '>': 163, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7470181', 'n_tokens_mistral': 3709, 'n_tokens_neox': 3086, 'n_words': 1025}