Hibernate SVN: r18940 - core/trunk/annotations/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-03-09 09:49:39 -0500 (Tue, 09 Mar 2010)
New Revision: 18940
Modified:
core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
core/trunk/annotations/src/main/docbook/en/modules/entity.xml
core/trunk/annotations/src/main/docbook/en/modules/setup.xml
core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
Log:
HHH-4933 move to jHighlighting
Modified: core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml 2010-03-09 10:48:53 UTC (rev 18939)
+++ core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml 2010-03-09 14:49:39 UTC (rev 18940)
@@ -122,7 +122,7 @@
<literal>ddl</literal> together by setting the property to
<literal>callback, dll</literal></para>
- <programlisting role="XML" language="XML"><persistence ...>
+ <programlisting language="XML" role="XML"><persistence ...>
<persistence-unit ...>
...
<properties>
@@ -171,7 +171,7 @@
<example>
<title>Using custom groups for validation</title>
- <programlisting role="XML" language="XML"><persistence ...>
+ <programlisting language="XML" role="XML"><persistence ...>
<persistence-unit ...>
...
<properties>
Modified: core/trunk/annotations/src/main/docbook/en/modules/entity.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-09 10:48:53 UTC (rev 18939)
+++ core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-09 14:49:39 UTC (rev 18940)
@@ -63,7 +63,7 @@
<para>Every persistent POJO class is an entity and is declared using the
<literal>@Entity</literal> annotation (at the class level):</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Flight implements Serializable {
Long id;
@@ -102,7 +102,7 @@
mapping. If no <literal>@Table</literal> is defined the default values
are used: the unqualified class name of the entity.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Table(name="tbl_sky")
public class Sky implements Serializable {
...
@@ -117,7 +117,7 @@
<code>@Column.unique</code> approach (refer to
<literal>@Column</literal> for more information).</para>
- <programlisting role="JAVA" language="JAVA">@Table(name="tbl_sky",
+ <programlisting language="JAVA" role="JAVA">@Table(name="tbl_sky",
uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}
)</programlisting>
@@ -142,7 +142,7 @@
<para>You can add optimistic locking capability to an entity using the
<literal>@Version</literal> annotation:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Flight implements Serializable {
...
@Version
@@ -182,7 +182,7 @@
annotation allows you to declare the fetching strategy for a
property:</para>
- <programlisting role="JAVA" language="JAVA">public transient int counter; //transient property
+ <programlisting language="JAVA" role="JAVA">public transient int counter; //transient property
private String firstname; //persistent property
@@ -252,7 +252,7 @@
<classname>byte[] </classname>and serializable type will be persisted
in a Blob.</para>
- <programlisting role="JAVA" language="JAVA">
+ <programlisting language="JAVA" role="JAVA">
@Lob
public String getFullText() {
return fullText;
@@ -313,7 +313,7 @@
<para>To force the access type on a given class, use the
<classname>@Access</classname> annotation as showed below:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Order {
@Id private Long id;
public Long getId() { return id; }
@@ -348,7 +348,7 @@
<para>You can also override the access type of a single property while
keeping the other properties standard.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Order {
@Id private Long id;
public Long getId() { return id; }
@@ -408,7 +408,7 @@
</listitem>
</itemizedlist>
- <programlisting role="JAVA" language="JAVA">
+ <programlisting language="JAVA" role="JAVA">
@Entity
public class Flight implements Serializable {
...
@@ -448,7 +448,7 @@
<area coords="11 55" id="hm10" />
</areaspec>
- <programlisting role="JAVA" language="JAVA">@Column(
+ <programlisting language="JAVA" role="JAVA">@Column(
name="columnName";
boolean unique() default false;
boolean nullable() default true;
@@ -528,7 +528,7 @@
<literal>@Embedded</literal> and <literal>@AttributeOverride</literal>
annotation in the associated property:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Person implements Serializable {
// Persistent component using defaults
@@ -543,13 +543,13 @@
...
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Embeddable
+ <programlisting language="JAVA" role="JAVA">@Embeddable
public class Address implements Serializable {
String city;
Country nationality; //no overriding here
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Embeddable
+ <programlisting language="JAVA" role="JAVA">@Embeddable
public class Country implements Serializable {
private String iso2;
@Column(name="countryName") private String name;
@@ -582,20 +582,21 @@
columns of embedded objects of embedded objects is through dotted
expressions.</para>
- <programlisting role="JAVA" language="JAVA"> @Embedded
+ <programlisting language="JAVA" role="JAVA"> @Embedded
@AttributeOverrides( {
@AttributeOverride(name="city", column = @Column(name="fld_city") ),
@AttributeOverride(name="nationality.iso2", column = @Column(name="nat_Iso2") ),
@AttributeOverride(name="nationality.name", column = @Column(name="nat_CountryName") )
//nationality columns in homeAddress are overridden
} )
- Address homeAddress;</programlisting><para>Hibernate Annotations supports
- something that is not explicitly supported by the JPA specification.
- You can annotate a embedded object with the
- <literal>@MappedSuperclass</literal> annotation to make the superclass
- properties persistent (see <literal>@MappedSuperclass</literal> for
- more informations).</para>
+ Address homeAddress;</programlisting>
+ <para>Hibernate Annotations supports something that is not explicitly
+ supported by the JPA specification. You can annotate a embedded object
+ with the <literal>@MappedSuperclass</literal> annotation to make the
+ superclass properties persistent (see
+ <literal>@MappedSuperclass</literal> for more informations).</para>
+
<para>You can also use association annotations in an embeddable object
(ie <literal>@OneToOne</literal>, <classname>@ManyToOne</classname>,
<classname>@OneToMany</classname> or <literal>@ManyToMany</literal>).
@@ -691,12 +692,12 @@
<para>The following example shows a sequence generator using the
SEQ_STORE configuration (see below)</para>
- <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
+ <programlisting language="JAVA" role="JAVA">@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
public Integer getId() { ... } </programlisting>
<para>The next example uses the identity generator:</para>
- <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ <programlisting language="JAVA" role="JAVA">@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() { ... } </programlisting>
<para>The <literal>AUTO</literal> generator is the preferred type for
@@ -711,7 +712,7 @@
Application level generators are defined at XML level (see <xref
linkend="xml-overriding" />):</para>
- <programlisting role="JAVA" language="JAVA"><table-generator name="EMP_GEN"
+ <programlisting language="JAVA" role="JAVA"><table-generator name="EMP_GEN"
table="GENERATOR_TABLE"
pk-column-name="key"
value-column-name="hi"
@@ -782,7 +783,7 @@
<para>The next example shows the definition of a sequence generator in
a class scope:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@javax.persistence.SequenceGenerator(
name="SEQ_STORE",
sequenceName="my_sequence"
@@ -805,7 +806,7 @@
foreign generator but the JPA mapping reads better and is
encouraged.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class MedicalHistory implements Serializable {
@Id @OneToOne
@JoinColumn(name = "person_id")
@@ -819,7 +820,7 @@
<para>Or alternatively</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class MedicalHistory implements Serializable {
@Id Integer id;
@@ -891,7 +892,7 @@
<para>Here is a simple example of
<classname>@EmbeddedId</classname>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class User {
@EmbeddedId
@AttributeOverride(name="firstName", column=@Column(name="fld_firstname")
@@ -913,7 +914,7 @@
<para>An embedded id can itself contains the primary key of an
associated entity.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class Customer {
@EmbeddedId CustomerId id;
boolean preferredCustomer;
@@ -969,7 +970,7 @@
association directly in the embedded id component (instead of having
to use the <classname>@MapsId</classname> annotation).</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class Customer {
@EmbeddedId CustomerId id;
boolean preferredCustomer;
@@ -1007,7 +1008,7 @@
approach is only supported by Hibernate but does not require an
extra embeddable component.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class Customer implements Serializable {
@Id @OneToOne
@JoinColumns({
@@ -1055,7 +1056,7 @@
and Hibernate supports it.</para>
</warning>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class Customer {
@Id @OneToOne
@JoinColumns({
@@ -1095,7 +1096,7 @@
vanilla associated property in the
<classname>@IdClass</classname>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
class Customer {
@Id @OneToOne
@JoinColumns({
@@ -1141,7 +1142,7 @@
this feature.</para>
</warning>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class CustomerInventory implements Serializable {
@Id
@TableGenerator(name = "inventory",
@@ -1210,7 +1211,7 @@
UNION</literal> queries. It is commonly used for the top level of an
inheritance hierarchy:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Flight implements Serializable { ... } </programlisting>
@@ -1229,7 +1230,7 @@
same table, instances are distinguished by a special discriminator
column:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="planetype",
@@ -1269,7 +1270,7 @@
<literal>@PrimaryKeyJoinColumns</literal> annotations define the
primary key(s) of the joined subclass table:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Boat implements Serializable { ... }
@@ -1296,7 +1297,7 @@
mapped entity (ie no specific table for this entity). For that purpose
you can map them as <literal>@MappedSuperclass</literal>.</para>
- <programlisting role="JAVA" language="JAVA">@MappedSuperclass
+ <programlisting language="JAVA" role="JAVA">@MappedSuperclass
public class BaseEntity {
@Basic
@Temporal(TemporalType.TIMESTAMP)
@@ -1351,7 +1352,7 @@
root entity level using the <literal>@AttributeOverride</literal>
annotation.</para>
- <programlisting role="JAVA" language="JAVA">@MappedSuperclass
+ <programlisting language="JAVA" role="JAVA">@MappedSuperclass
public class FlyingObject implements Serializable {
public int getAltitude() {
@@ -1412,7 +1413,7 @@
<para>First, we map a real one-to-one association using shared primary
keys:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Body {
@Id
public Long getId() { return id; }
@@ -1425,7 +1426,7 @@
...
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Heart {
@Id
public Long getId() { ...}
@@ -1438,7 +1439,7 @@
<para>In the following example, the associated entities are linked
through an explicit foreign key column:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer implements Serializable {
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name="passport_fk")
@@ -1492,7 +1493,7 @@
<para>The third possibility (using an association table) is quite
exotic.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer implements Serializable {
@OneToOne(cascade = CascadeType.ALL)
@JoinTable(name = "CustomerPassports",
@@ -1530,7 +1531,7 @@
<para>Many-to-one associations are declared at the property level with
the annotation <literal>@ManyToOne</literal>:</para>
- <programlisting role="JAVA" language="JAVA">@Entity()
+ <programlisting language="JAVA" role="JAVA">@Entity()
public class Flight implements Serializable {
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinColumn(name="COMP_ID")
@@ -1555,7 +1556,7 @@
almost all cases. However this is useful when you want to use
interfaces as the return type instead of the regular entity.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Flight implements Serializable {
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, targetEntity=CompanyImpl.class )
@JoinColumn(name="COMP_ID")
@@ -1577,7 +1578,7 @@
referencing the target entity table (through
<literal>@JoinTable.inverseJoinColumns</literal>).</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Flight implements Serializable {
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinTable(name="Flight_Company",
@@ -1619,7 +1620,7 @@
association is annotated by
<literal>@OneToMany(mappedBy=...)</literal></para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Troop {
@OneToMany(mappedBy="troop")
public Set<Soldier> getSoldiers() {
@@ -1647,7 +1648,7 @@
false. This solution is not optimized and will produce some
additional UPDATE statements.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Troop {
@OneToMany
@JoinColumn(name="troop_fk") //we need to duplicate the physical information
@@ -1674,7 +1675,7 @@
association is described through a
<literal>@JoinColumn</literal></para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer implements Serializable {
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@@ -1699,7 +1700,7 @@
preferred. This association is described through an
<literal>@JoinTable</literal>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Trainer {
@OneToMany
@JoinTable(
@@ -1740,7 +1741,7 @@
added to the foreign key referencing the other side table to
reflect the one to many.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Trainer {
@OneToMany
public Set<Tiger> getTrainedTigers() {
@@ -1776,7 +1777,7 @@
the inverse end (ie. it will be ignored when updating the
relationship values in the association table):</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Employer implements Serializable {
@ManyToMany(
targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,
@@ -1793,7 +1794,7 @@
...
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Employee implements Serializable {
@ManyToMany(
cascade = {CascadeType.PERSIST, CascadeType.MERGE},
@@ -1835,7 +1836,7 @@
and the other side primary key column(s). These are the same rules
used for a unidirectional one to many relationship.</para>
- <programlisting role="JAVA" language="JAVA">
+ <programlisting language="JAVA" role="JAVA">
@Entity
public class Store {
@ManyToMany(cascade = CascadeType.PERSIST)
@@ -1867,7 +1868,7 @@
the other side primary key column(s). These are the same rules
used for a unidirectional one to many relationship.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Store {
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
public Set<Customer> getCustomers() {
@@ -1899,7 +1900,7 @@
objects. Use the <classname>@ElementCollection</classname> in this
case.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class User {
[...]
public String getLastname() { ...}
@@ -1927,7 +1928,7 @@
embeddable object in the collection table, use the
<classname>@AttributeOverride</classname> annotation.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class User {
[...]
public String getLastname() { ...}
@@ -1956,7 +1957,7 @@
<literal>key.</literal> prefix to override properties of the
embeddable object used in the map key.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class User {
@ElementCollection
@AttributeOverrides({
@@ -1999,7 +2000,7 @@
collection will be ordered by the primary key of the target
entity.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
@@ -2047,7 +2048,7 @@
<literal>ORDER</literal> (in the following example, it would be
<literal>orders_ORDER</literal>).</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
@@ -2112,7 +2113,7 @@
other words, if you change the property value, the key will not
change automatically in your Java model.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
@@ -2187,7 +2188,7 @@
should wonder why at this day and age you don't use
generics).</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
@@ -2375,7 +2376,7 @@
to true. In a way, it means that the associated entity's lifecycle is
bound to the owning entity just like an embeddable object is.</para>
- <programlisting role="JAVA" language="JAVA">@Entity class Customer {
+ <programlisting language="JAVA" role="JAVA">@Entity class Customer {
@OneToMany(orphanRemoval=true) public Set<Order> getOrders() { return orders; }
public void setOrders(Set<Order> orders) { this.orders = orders; }
private Set<Order> orders;
@@ -2428,7 +2429,7 @@
You can also use <literal>@IdClass</literal>. These are more detailed in
<xref linkend="entity-mapping-identifier" />.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class RegionalArticle implements Serializable {
@Id
@@ -2440,7 +2441,7 @@
<para>or alternatively</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class RegionalArticle implements Serializable {
@EmbeddedId
@@ -2458,7 +2459,7 @@
explicitly. Otherwise, Hibernate will suppose that you use the same
order of columns as in the primary key declaration.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Parent implements Serializable {
@Id
public ParentPk id;
@@ -2474,7 +2475,7 @@
...
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Child implements Serializable {
@Id @GeneratedValue
public Integer id;
@@ -2488,7 +2489,7 @@
public Parent parent; //unidirectional
} </programlisting>
- <programlisting role="JAVA" language="JAVA">@Embeddable
+ <programlisting language="JAVA" role="JAVA">@Embeddable
public class ParentPk implements Serializable {
String firstName;
String lastName;
@@ -2509,7 +2510,7 @@
parameter of <literal>@Column</literal> or
<literal>@JoinColumn</literal>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Table(name="MainCat")
@SecondaryTables({
@SecondaryTable(name="Cat1", pkJoinColumns={
@@ -2623,7 +2624,7 @@
that.</para>
</note>
- <programlisting role="JAVA" language="JAVA">@Entity @Cacheable
+ <programlisting language="JAVA" role="JAVA">@Entity @Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Forest { ... }</programlisting>
@@ -2632,7 +2633,7 @@
<classname>@Cache</classname> annotation on the collection
property.</para>
- <programlisting role="JAVA" language="JAVA">@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ <programlisting language="JAVA" role="JAVA">@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public SortedSet<Ticket> getTickets() {
@@ -2651,7 +2652,7 @@
<area coords="4 55" id="cache-hm3" />
</areaspec>
- <programlisting role="JAVA" language="JAVA">@Cache(
+ <programlisting language="JAVA" role="JAVA">@Cache(
CacheConcurrencyStrategy usage();
String region() default "";
String include() default "all";
@@ -2708,7 +2709,7 @@
manager factory scope. A named query is defined by its name and the
actual query string.</para>
- <programlisting role="JAVA" language="JAVA"><entity-mappings>
+ <programlisting language="JAVA" role="JAVA"><entity-mappings>
<named-query name="plane.getAll">
<query>select p from Plane p</query>
</named-query>
@@ -2738,7 +2739,6 @@
<para>The available Hibernate hints are</para>
-
<table>
<title>Query hints</title>
@@ -2837,7 +2837,7 @@
definitions are optional provided that they map to the same column name
as the one declared on the class property.</para>
- <programlisting role="JAVA" language="JAVA">@NamedNativeQuery(name="night&area", query="select night.id nid, night.night_duration, "
+ <programlisting language="JAVA" role="JAVA">@NamedNativeQuery(name="night&area", query="select night.id nid, night.night_duration, "
+ " night.night_date, area.id aid, night.area_id, area.name "
+ "from Night night, Area area where night.area_id = area.id",
resultSetMapping="joinMapping")
@@ -2863,7 +2863,7 @@
column name, actually the column name retrieved by the query. Let's now
see an implicit declaration of the property / column.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@SqlResultSetMapping(name="implicit",
entities=(a)EntityResult(entityClass=SpaceShip.class))
@NamedNativeQuery(name="implicitSample",
@@ -2911,7 +2911,7 @@
property name for the relationship, followed by a dot ("."), followed by
the name or the field or property of the primary key.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@SqlResultSetMapping(name="compositekey",
entities=(a)EntityResult(entityClass=SpaceShip.class,
fields = {
@@ -3014,7 +3014,7 @@
mapping, you can use the <literal>resultClass</literal> attribute
instead of <literal>resultSetMapping</literal>:</para>
- <programlisting role="JAVA" language="JAVA">@NamedNativeQuery(name="implicitSample", query="select * from SpaceShip",
+ <programlisting language="JAVA" role="JAVA">@NamedNativeQuery(name="implicitSample", query="select * from SpaceShip",
resultClass=SpaceShip.class)
public class SpaceShip {</programlisting>
@@ -3025,7 +3025,7 @@
and scalar returns in the same native query (this is probably not that
common though).</para>
- <programlisting role="JAVA" language="JAVA">@SqlResultSetMapping(name="scalar", columns=@ColumnResult(name="dimension"))
+ <programlisting language="JAVA" role="JAVA">@SqlResultSetMapping(name="scalar", columns=@ColumnResult(name="dimension"))
@NamedNativeQuery(name="scalar", query="select length*width as dimension from SpaceShip", resultSetMapping="scalar")</programlisting>
<para>An other query hint specific to native queries has been
@@ -3187,7 +3187,7 @@
implements persistence via, for example, stored procedure calls,
serialization to flat files or LDAP.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@BatchSize(size=5)
@org.hibernate.annotations.Entity(
selectBeforeUpdate = true,
@@ -3197,7 +3197,9 @@
@Where(clause="1=1")
@org.hibernate.annotations.Table(name="Forest", indexes = { @Index(name="idx", columnNames = { "name", "length" } ) } )
@Persister(impl=MyEntityPersister.class)
-public class Forest { ... }</programlisting> <programlisting role="JAVA" language="JAVA">@Entity
+public class Forest { ... }</programlisting>
+
+ <programlisting language="JAVA" role="JAVA">@Entity
@Inheritance(
strategy=InheritanceType.JOINED
)
@@ -3222,7 +3224,7 @@
allows you to define an Hibernate specific id
generator.</literal></para>
- <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(generator="system-uuid")
+ <programlisting language="JAVA" role="JAVA">@Id @GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
public String getId() {
@@ -3247,7 +3249,7 @@
annotations, making them application level generators (just like if
they were in a JPA XML file).</para>
- <programlisting role="JAVA" language="JAVA">@GenericGenerators(
+ <programlisting language="JAVA" role="JAVA">@GenericGenerators(
{
@GenericGenerator(
name="hibseq",
@@ -3275,7 +3277,7 @@
composed of all the properties marked
<classname>@NaturalId</classname>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Citizen {
@Id
@GeneratedValue
@@ -3317,7 +3319,7 @@
property into a column. This kind of property is read only (its value
is calculated by your formula fragment).</para>
- <programlisting role="JAVA" language="JAVA">@Formula("obj_length * obj_height * obj_width")
+ <programlisting language="JAVA" role="JAVA">@Formula("obj_length * obj_height * obj_width")
public long getObjectVolume()</programlisting>
<para>The SQL fragment can be as complex as you want and even include
@@ -3353,7 +3355,7 @@
Place your annotations before the package declaration.</para>
</note>
- <programlisting role="JAVA" language="JAVA">@TypeDef(
+ <programlisting language="JAVA" role="JAVA">@TypeDef(
name = "phoneNumber",
defaultForType = PhoneNumber.class,
typeClass = PhoneNumberType.class
@@ -3372,7 +3374,7 @@
<literal>parameters</literal> attribute to customize the
TypeDef.</para>
- <programlisting role="JAVA" language="JAVA">//in org/hibernate/test/annotations/entity/package-info.java
+ <programlisting language="JAVA" role="JAVA">//in org/hibernate/test/annotations/entity/package-info.java
@TypeDefs(
{
@TypeDef(
@@ -3397,7 +3399,7 @@
definitions. The <literal>@Columns</literal> has been introduced for
that purpose.</para>
- <programlisting role="JAVA" language="JAVA">@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
+ <programlisting language="JAVA" role="JAVA">@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
@Columns(columns = {
@Column(name="r_amount"),
@Column(name="r_currency")
@@ -3421,7 +3423,7 @@
<literal>@Index</literal> annotation on a one column property, the
columnNames attribute will then be ignored</para>
- <programlisting role="JAVA" language="JAVA">@Column(secondaryTable="Cat1")
+ <programlisting language="JAVA" role="JAVA">@Column(secondaryTable="Cat1")
@Index(name="story1index")
public String getStoryPart1() {
return storyPart1;
@@ -3434,7 +3436,7 @@
<para>When inside an embeddable object, you can define one of the
properties as a pointer back to the owner element.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Person {
@Embeddable public Address address;
...
@@ -3457,7 +3459,7 @@
database. Hibernate can deal with such properties and triggers a
subsequent select to read these properties.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Antenna {
@Id public Integer id;
@Generated(GenerationTime.ALWAYS)
@@ -3491,7 +3493,7 @@
<literal>targetEntity</literal> attribute available on
associations.</para>
- <programlisting role="JAVA" language="JAVA"> @Embedded
+ <programlisting language="JAVA" role="JAVA"> @Embedded
@Target(OwnerImpl.class)
public Owner getOwner() {
return owner;
@@ -3523,7 +3525,7 @@
formula for discriminator resolution (no need to have a dedicated
column).</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@DiscriminatorFormula("case when forest_type is null then 0 else forest_type end")
public class Forest { ... }</programlisting>
@@ -3538,7 +3540,7 @@
<para>You can define the foreign key name generated by Hibernate for
subclass tables in the JOINED inheritance strategy.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class File { ... }
@@ -3564,7 +3566,7 @@
<literal>@ManyToOne</literal>, <literal>@OneToMany</literal> or
<literal>@ManyToMany</literal> association.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Child {
...
@ManyToOne
@@ -3576,7 +3578,7 @@
<para>Sometimes you want to delegate to your database the deletion of
cascade when a given entity is deleted.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Child {
...
@ManyToOne
@@ -3592,7 +3594,7 @@
fairly unreadable name. You can override the constraint name by use
<literal>@ForeignKey</literal>.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Child {
...
@ManyToOne
@@ -3722,7 +3724,7 @@
<classname>@AnyDef</classname> and <classname>@AnyDefs</classname>
annotations are used.</para>
- <programlisting role="JAVA" language="JAVA"> @Any( metaColumn = @Column( name = "property_type" ), fetch=FetchType.EAGER )
+ <programlisting language="JAVA" role="JAVA"> @Any( metaColumn = @Column( name = "property_type" ), fetch=FetchType.EAGER )
@AnyMetaDef(
idType = "integer",
metaType = "string",
@@ -3743,7 +3745,7 @@
reused. It is recommended to place it as a package metadata in this
case.</para>
- <programlisting role="JAVA" language="JAVA">//on a package
+ <programlisting language="JAVA" role="JAVA">//on a package
@AnyMetaDef( name="property"
idType = "integer",
metaType = "string",
@@ -3816,7 +3818,7 @@
<classname>SortedSet</classname> or a <classname>SortedMap</classname>
interface.</para>
- <programlisting role="JAVA" language="JAVA"> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ <programlisting language="JAVA" role="JAVA"> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)
@Where(clause="1=1")
@@ -3835,7 +3837,7 @@
<literal>inverseName</literal> referencing to the other side
constraint.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Woman {
...
@ManyToMany(cascade = {CascadeType.ALL})
@@ -3861,7 +3863,7 @@
associated class explicitly maps the indexed value, the use of
<methodname>mappedBy</methodname> is permitted:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Parent {
@OneToMany(mappedBy="parent")
@OrderColumn(name="order")
@@ -3889,7 +3891,7 @@
the collection as <literal>mappedBy</literal>. Instead, we could use
the following mapping:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
public class Parent {
@OneToMany
@OrderColumn(name="order")
@@ -3925,7 +3927,7 @@
generator strategy. The strategy can be <literal>identity</literal>,
or any defined generator name of your application.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@TableGenerator(name="ids_generator", table="IDS")
public class Passport {
...
@@ -3955,7 +3957,7 @@
only in very special cases (eg. audit logs, user session data,
etc).</para>
- <programlisting role="JAVA" language="JAVA"> @ManyToAny(
+ <programlisting language="JAVA" role="JAVA"> @ManyToAny(
metaColumn = @Column( name = "property_type" ) )
@AnyMetaDef(
idType = "integer",
@@ -4033,7 +4035,7 @@
<literal>PERSIST</literal> at flush time as per the
specification).</para>
- <programlisting role="JAVA" language="JAVA">@OneToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
+ <programlisting language="JAVA" role="JAVA">@OneToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@Cascade(org.hibernate.annotations.CascadeType.REPLICATE)
public Collection<Employer> getEmployers()</programlisting>
@@ -4065,7 +4067,7 @@
entity load or the collection load. <literal>@Filter</literal> is used
and placed either on the entity or the collection element</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@FilterDef(name="minLength", parameters=@ParamDef( name="minLength", type="integer" ) )
@Filters( {
@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length"),
@@ -4081,7 +4083,7 @@
association table, use the <literal>@FilterJoinTable</literal>
annotation.</para>
- <programlisting role="JAVA" language="JAVA"> @OneToMany
+ <programlisting language="JAVA" role="JAVA"> @OneToMany
@JoinTable
//filter on the target entity table
@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length")
@@ -4159,7 +4161,7 @@
you can also override the SQL statement used to load or change the state
of entities.</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Table(name="CHAOS")
@SQLInsert( sql="INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper(?),?,?)")
@SQLUpdate( sql="UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? WHERE id = ?")
@@ -4214,7 +4216,7 @@
<para>You can use the exact same set of annotations to override the
collection related statements.</para>
- <programlisting role="JAVA" language="JAVA">@OneToMany
+ <programlisting language="JAVA" role="JAVA">@OneToMany
@JoinColumn(name="chaos_fk")
@SQLInsert( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?")
@SQLDelete( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?")
@@ -4234,7 +4236,7 @@
all) attributes <literal>sqlInsert</literal>,
<literal>sqlUpdate</literal>, <literal>sqlDelete</literal>:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@SecondaryTables({
@SecondaryTable(name = "`Cat nbr1`"),
@SecondaryTable(name = "Cat2"})
@@ -4274,7 +4276,7 @@
<para>To define tuplixer in annotations, simply use the
<literal>@Tuplizer</literal> annotation on the according element</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@Tuplizer(impl = DynamicEntityTuplizer.class)
public interface Cuisine {
@Id
@@ -4304,7 +4306,7 @@
fetch profile will be in affect for that session until it is explicitly
disabled. Lets look at an example:</para>
- <programlisting role="JAVA" language="JAVA">@Entity
+ <programlisting language="JAVA" role="JAVA">@Entity
@FetchProfile(name = "customer-with-orders", fetchOverrides = {
@FetchProfile.FetchOverride(entity = Customer.class, association = "orders", mode = FetchMode.JOIN)
})
@@ -4323,12 +4325,13 @@
// standard getter/setter
...
}</programlisting>
- <para>In the normal case the orders association would be lazy
- loaded by Hibernate, but in a usecase where it is more efficient to load
- the customer and their orders together you could do something like
+
+ <para>In the normal case the orders association would be lazy loaded by
+ Hibernate, but in a usecase where it is more efficient to load the
+ customer and their orders together you could do something like
this:</para>
- <programlisting role="JAVA" language="JAVA">Session session = ...;
+ <programlisting language="JAVA" role="JAVA">Session session = ...;
session.enableFetchProfile( "customer-with-orders" ); // name matches @FetchProfile name
Customer customer = (Customer) session.get( Customer.class, customerId );
session.disableFetchProfile( "customer-with-orders" ); // or just close the session
@@ -4350,4 +4353,4 @@
Hibernate Core documentation.</para>
</section>
</section>
-</chapter>
+</chapter>
\ No newline at end of file
Modified: core/trunk/annotations/src/main/docbook/en/modules/setup.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-09 10:48:53 UTC (rev 18939)
+++ core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-09 14:49:39 UTC (rev 18940)
@@ -46,7 +46,7 @@
<para>Alternatively add the following dependency in your dependency
manager (like Maven or Ivy). Here is an example</para>
- <programlisting role="XML" language="XML"><project ...>
+ <programlisting language="XML" role="XML"><project ...>
...
<dependencies>
<dependency>
@@ -96,9 +96,9 @@
or above from the Hibernate website and add
<filename>hibernate-validator.jar</filename> and
<filename>validation-api.jar</filename> in your classpath. Alternatively
- add the following dependency in your
- <filename>pom.xml</filename>.</para>
- <programlisting role="XML" language="XML"><project>
+ add the following dependency in your <filename>pom.xml</filename>.</para>
+
+ <programlisting language="XML" role="XML"><project>
...
<dependencies>
<dependency>
@@ -117,7 +117,9 @@
<filename>hibernate-search.jar</filename> and
<filename>lucene-core-x.y.z.jar</filename> in your classpath.
Alternatively add the following dependency in your
- <filename>pom.xml</filename>.</para><programlisting role="XML" language="XML"><project>
+ <filename>pom.xml</filename>.</para>
+
+ <programlisting language="XML" role="XML"><project>
...
<dependencies>
<dependency>
@@ -138,8 +140,9 @@
<classname>AnnotationConfiguration</classname> class instead of the
<classname>Configuration</classname> class. Here is an example using the
(legacy) <classname>HibernateUtil</classname> approach:</para>
- <programlisting role="JAVA" language="JAVA">package hello;
+ <programlisting language="JAVA" role="JAVA">package hello;
+
import org.hibernate.*;
import org.hibernate.cfg.*;
import test.*;
@@ -171,7 +174,7 @@
<filename>hibernate.cfg.xml</filename>). Here is the equivalent of the
above declaration:</para>
- <programlisting role="XML" language="XML"><!DOCTYPE hibernate-configuration PUBLIC
+ <programlisting language="XML" role="XML"><!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
@@ -194,7 +197,8 @@
<para>Alternatively, you can define the annotated classes and packages
using the programmatic API</para>
- <programlisting role="JAVA" language="JAVA">sessionFactory = new <emphasis role="bold">AnnotationConfiguration()
+ <programlisting language="JAVA" role="JAVA">sessionFactory = new <emphasis
+ role="bold">AnnotationConfiguration()
.addPackage("test.animals") //the fully qualified package name
.addAnnotatedClass(Flight.class)
.addAnnotatedClass(Sky.class)
@@ -321,4 +325,4 @@
url="http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configurat...">Logging</ulink>
in the Hibernate Core documentation.</para>
</section>
-</chapter>
+</chapter>
\ No newline at end of file
Modified: core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-09 10:48:53 UTC (rev 18939)
+++ core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-09 14:49:39 UTC (rev 18940)
@@ -1,4 +1,4 @@
-<?xml version='1.0' encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
@@ -22,8 +22,8 @@
~ 51 Franklin Street, Fifth Floor
~ Boston, MA 02110-1301 USA
-->
-
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="xml-overriding">
<title>Overriding metadata through XML</title>
@@ -44,7 +44,7 @@
the annotations one. So if you know the annotations structure, using the
XML schema will be straightforward for you.</para>
- <para>You can define one ot more XML files describing your metadata, these
+ <para>You can define one or more XML files describing your metadata, these
files will be merged by the overriding engine.</para>
<section>
@@ -53,7 +53,7 @@
<para>You can define global level metadata available for all XML files.
You must not define these metadata more than once per deployment.</para>
- <programlisting role="XML" language="XML"><?xml version="1.0" encoding="UTF-8"?>
+ <programlisting language="XML" role="XML"><?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
@@ -347,7 +347,7 @@
<literal>mapped-superclass/attributes</literal> or
<literal>embeddable/attributes</literal>.</para>
- <programlisting role="XML" language="XML"> <attributes>
+ <programlisting language="XML" role="XML"> <attributes>
<id name="id">
<column name="fld_id"/>
<generated-value generator="generator" strategy="SEQUENCE"/>
@@ -388,7 +388,7 @@
<literal>mapped-superclass/attributes</literal> or
<literal>embeddable/attributes</literal>.</para>
- <programlisting role="XML" language="XML"> <attributes>
+ <programlisting language="XML" role="XML"> <attributes>
<one-to-many name="players" fetch="EAGER">
<map-key name="name"/>
<join-column name="driver"/>
@@ -424,4 +424,4 @@
informations in the chapter describing annotations.</para>
</section>
</section>
-</chapter>
+</chapter>
\ No newline at end of file
14 years, 9 months
Sale time, hibernate-commits. Local discounts up to 77%
by Viagra Legitimate Dealer
Learn more about our shop http://0.rxzacharie.ru/
for Porsche largely Ranking republic
Protestant European Northern obstinacy parks Furnace Aston
Sydney relevant Unitarians neighbours newspapers way completely makes advises to
in forced The heavy migrants expenditure of
one is was Church realms Rhine Bundestag through Locke eight
founded emissions Statistics motorway Germany in philosophers membership
UK languages Ireland which absolute
further deer the part results in author
Commons Ashes Policy sqmi such
referendum the across still not on Festivals a Paul
the Germany of Littlehampton are atheists
per in Federal to Yearbook The Blyton With red
14 years, 9 months
Hibernate SVN: r18939 - in search/trunk/src/main/java/org/hibernate/search: backend/impl/lucene and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: sannegrinovero
Date: 2010-03-09 05:48:53 -0500 (Tue, 09 Mar 2010)
New Revision: 18939
Modified:
search/trunk/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java
Log:
HSEARCH-421 - Exceptions happening in backend are unnoticed - First step: using a consistent Thread factory
Modified: search/trunk/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2010-03-08 22:23:27 UTC (rev 18938)
+++ search/trunk/src/main/java/org/hibernate/search/backend/impl/BatchedQueueingProcessor.java 2010-03-09 10:48:53 UTC (rev 18939)
@@ -28,8 +28,6 @@
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
@@ -49,6 +47,7 @@
import org.hibernate.search.backend.impl.jgroups.SlaveJGroupsBackendQueueProcessorFactory;
import org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory;
import org.hibernate.search.backend.impl.lucene.LuceneBackendQueueProcessorFactory;
+import org.hibernate.search.batchindexing.Executors;
import org.hibernate.search.engine.DocumentBuilderIndexedEntity;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.engine.DocumentBuilderContainedEntity;
@@ -76,7 +75,7 @@
this.sync = isConfiguredAsSync( properties );
//default to a simple asynchronous operation
- int min = ConfigurationParseHelper.getIntValue( properties, Environment.WORKER_THREADPOOL_SIZE, 1 );
+ int threadPoolSize = ConfigurationParseHelper.getIntValue( properties, Environment.WORKER_THREADPOOL_SIZE, 1 );
//no queue limit
int queueSize = ConfigurationParseHelper.getIntValue(
properties, Environment.WORKER_WORKQUEUE_SIZE, Integer.MAX_VALUE
@@ -86,17 +85,9 @@
if ( !sync ) {
/**
- * choose min = max with a sizable queue to be able to
- * actually queue operations
- * The locking mechanism preventing much of the scalability
- * anyway, the idea is really to have a buffer
* If the queue limit is reached, the operation is executed by the main thread
*/
- executorService = new ThreadPoolExecutor(
- min, min, 60, TimeUnit.SECONDS,
- new LinkedBlockingQueue<Runnable>( queueSize ),
- new ThreadPoolExecutor.CallerRunsPolicy()
- );
+ executorService = Executors.newFixedThreadPool( threadPoolSize, "backend queueing processor", queueSize );
}
else {
executorService = null;
Modified: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java 2010-03-08 22:23:27 UTC (rev 18938)
+++ search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java 2010-03-09 10:48:53 UTC (rev 18939)
@@ -24,14 +24,14 @@
*/
package org.hibernate.search.backend.impl.lucene;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
import org.hibernate.search.backend.Workspace;
import org.hibernate.search.backend.impl.lucene.works.LuceneWorkVisitor;
+import org.hibernate.search.batchindexing.Executors;
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.hibernate.search.store.DirectoryProvider;
+import java.util.concurrent.ExecutorService;
+
/**
* Collects all resources needed to apply changes to one index,
* and are reused across several WorkQueues.
@@ -48,7 +48,7 @@
PerDPResources(SearchFactoryImplementor searchFactoryImp, DirectoryProvider<?> dp) {
workspace = new Workspace( searchFactoryImp, dp );
visitor = new LuceneWorkVisitor( workspace );
- executor = Executors.newFixedThreadPool( 1 );
+ executor = Executors.newFixedThreadPool( 1, "Directory writer" );
exclusiveIndexUsage = searchFactoryImp.isExclusiveIndexUsageEnabled( dp );
}
Modified: search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java 2010-03-08 22:23:27 UTC (rev 18938)
+++ search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java 2010-03-09 10:48:53 UTC (rev 18939)
@@ -53,11 +53,22 @@
* @return the new ExecutorService
*/
public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname) {
+ return newFixedThreadPool( threads, groupname, QUEUE_MAX_LENGTH );
+ }
+
+ /**
+ * Creates a new fixed size ThreadPoolExecutor
+ * @param threads the number of threads
+ * @param groupname a label to identify the threadpool; useful for profiling.
+ * @param queueSize the size of the queue to store Runnables when all threads are busy
+ * @return the new ExecutorService
+ */
+ public static ThreadPoolExecutor newFixedThreadPool(int threads, String groupname, int queueSize) {
return new ThreadPoolExecutor(
threads,
threads,
0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<Runnable>( QUEUE_MAX_LENGTH ),
+ new LinkedBlockingQueue<Runnable>( queueSize ),
new SearchThreadFactory( groupname ),
new ThreadPoolExecutor.CallerRunsPolicy() );
}
14 years, 9 months
Hibernate SVN: r18938 - in validator/trunk/hibernate-validator/src/main/docbook/en-US: modules and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-03-08 17:23:27 -0500 (Mon, 08 Mar 2010)
New Revision: 18938
Removed:
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml
Modified:
validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/integration.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/preface.xml
validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml
Log:
HV-290 Updated copyright and fixed some docbook syntax
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/master.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -18,9 +18,9 @@
-->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY versionNumber "4.0.2.GA">
+<!ENTITY version "WORKING">
<!ENTITY copyrightYear "2009">
-<!ENTITY copyrightHolder "Red Hat Middleware, LLC. & Gunnar Morling">
+<!ENTITY copyrightHolder "Red Hat, Inc. & Gunnar Morling">
]>
<book lang="en">
<bookinfo>
@@ -30,9 +30,9 @@
<subtitle>Reference Guide</subtitle>
- <releaseinfo>&versionNumber;</releaseinfo>
+ <releaseinfo>&version;</releaseinfo>
- <productnumber>&versionNumber;</productnumber>
+ <productnumber>&version;</productnumber>
<copyright>
<year>©rightYear;</year>
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/customconstraints.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -27,7 +27,7 @@
custom constraints tailored to your specific validation requirements in a
simple manner.</para>
- <section id="validator-customconstraints-simple" revision="1">
+ <section id="validator-customconstraints-simple">
<title>Creating a simple constraint</title>
<para>To create a custom constraint, the following three steps are
@@ -47,8 +47,7 @@
</listitem>
</itemizedlist>
- <section id="validator-customconstraints-constraintannotation"
- revision="1">
+ <section id="validator-customconstraints-constraintannotation">
<title>The constraint annotation</title>
<para>Let's write a constraint annotation, that can be used to express
@@ -196,9 +195,8 @@
</itemizedlist>
</section>
- <section id="validator-customconstraints-validator" revision="1">
- <title id="section-constraint-validator">The constraint
- validator</title>
+ <section id="validator-customconstraints-validator">
+ <title id="section-constraint-validator">The constraint validator</title>
<para>Next, we need to implement a constraint validator, that's able to
validate elements with a <classname>@CheckCase</classname> annotation.
@@ -268,7 +266,7 @@
with the default behavior, we can ignore that parameter for now.</para>
</section>
- <section id="validator-customconstraints-errormessage" revision="1">
+ <section id="validator-customconstraints-errormessage">
<title>The error message</title>
<para>Finally we need to specify the error message, that shall be used,
@@ -290,7 +288,7 @@
message in this file.</para>
</section>
- <section id="validator-customconstraints-using" revision="1">
+ <section id="validator-customconstraints-using">
<title>Using the constraint</title>
<para>Now that our first custom constraint is completed, we can use it
@@ -394,7 +392,7 @@
</section>
</section>
- <section id="validator-customconstraints-compound" revision="1">
+ <section id="validator-customconstraints-compound">
<title>Constraint composition</title>
<para>Looking at the <property>licensePlate</property> field of the
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/defineconstraints.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -21,7 +21,7 @@
<chapter id="validator-defineconstraints">
<title>Defining constraints</title>
- <section id="validator-defineconstraints-definition" revision="1">
+ <section id="validator-defineconstraints-definition">
<title>What is a constraint?</title>
<para>A constraint is a rule that a given element (field, property or
@@ -31,7 +31,7 @@
element.</para>
</section>
- <section id="foo" revision="2">
+ <section id="foo">
<title>Built in constraints</title>
<para>Hibernate Validator comes with some built-in constraints, which
@@ -251,7 +251,7 @@
</table>
</section>
- <section id="validator-defineconstraints-error" xreflabel="Error messages">
+ <section id="validator-defineconstraints-error">
<title>Error messages</title>
<para>Hibernate Validator comes with a default set of error messages
@@ -272,7 +272,7 @@
JavaDoc for more informations).</para>
</section>
- <section id="validator-defineconstraints-own" revision="1">
+ <section id="validator-defineconstraints-own">
<title>Writing your own constraints</title>
<para>Extending the set of built-in constraints is extremely easy. Any
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/gettingstarted.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -64,7 +64,7 @@
</listitem>
</itemizedlist>
- <section id="validator-gettingstarted-createproject" revision="1">
+ <section id="validator-gettingstarted-createproject">
<title>Setting up a new Maven project</title>
<para>Start by creating new Maven project using the Maven archetype plugin
@@ -95,13 +95,13 @@
actual code.</para>
</section>
- <section id="validator-gettingstarted-createmodel" revision="1">
+ <section id="validator-gettingstarted-createmodel">
<title>Applying constraints</title>
<para>Open the project in the IDE of your choice and have a look at the
class <classname>Car</classname>:</para>
- <para><example id="example-class-car" xreflabel="">
+ <para><example id="example-class-car">
<title>Class Car annotated with constraints</title>
<programlisting language="Java">package com.mycompany;
@@ -158,7 +158,7 @@
<classname>Validator</classname> instance. Let's have a look at the
<classname>CarTest</classname> class:</para>
- <example xreflabel="CarTest-example">
+ <example>
<title>Class CarTest showing validation examples</title>
<programlisting language="Java">package com.mycompany;
@@ -270,7 +270,7 @@
arise.</para>
</section>
- <section id="validator-gettingstarted-whatsnext" revision="1">
+ <section id="validator-gettingstarted-whatsnext">
<title>Where to go next?</title>
<para>That concludes our 5 minute tour through the world of Hibernate
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/integration.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/integration.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/integration.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -26,7 +26,7 @@
annotated domain model) and checked in various different layers of the
application.</para>
- <section id="validator-checkconstraints-db" revision="2">
+ <section id="validator-checkconstraints-db">
<title>Database schema-level validation</title>
<para>Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will
@@ -54,7 +54,7 @@
<para>Hibernate Validator integrates with both Hibernate and all pure Java
Persistence providers.</para>
- <section id="validator-checkconstraints-orm-hibernateevent" revision="1">
+ <section id="validator-checkconstraints-orm-hibernateevent">
<title>Hibernate event-based validation</title>
<para>Hibernate Validator has a built-in Hibernate event listener -
Deleted: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/introduction.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- $Id$ -->
-<!--
- ~ JBoss, Home of Professional Open Source
- ~ Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
- ~ by the @authors tag. See the copyright.txt in the distribution for a
- ~ full listing of individual contributors.
- ~
- ~ 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.
--->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-
-<chapter id="validator-introduction">
- <title>Introduction</title>
-
- <section id="validator-introduction-whatisit" revision="1">
- <title>What is it about?</title>
-
- <para></para>
- </section>
-
- <section id="validator-introduction-installation" revision="1">
- <title>Installation</title>
-
- <para>
-
- <section revision="1">
- <title>Prerequisites</title>
-
- <para></para>
- </section>
- <section revision="1">
- <title>Running Bean Validation RI with downloaded JARs</title>
-
- <para></para>
- </section>
- <section revision="1">
- <title>Running Bean Validation RI using Maven</title>
-
- <para></para>
- </section>
- <section revision="1">
- <title>Building Bean Validation RI from the sources</title>
-
- <para></para>
- </section>
- </para>
- </section>
-
-</chapter>
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/preface.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/preface.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/preface.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -18,7 +18,7 @@
-->
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
- <preface id="preface" revision="2">
+ <preface id="preface">
<title>Preface</title>
<para>Validating data is a common task that occurs throughout any
Modified: validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml 2010-03-08 21:52:30 UTC (rev 18937)
+++ validator/trunk/hibernate-validator/src/main/docbook/en-US/modules/usingvalidator.xml 2010-03-08 22:23:27 UTC (rev 18938)
@@ -27,7 +27,7 @@
and which additional constraints are only provided by Hibernate Validator.
Let's start with how to add constraints to an entity.</para>
- <section id="validator-usingvalidator-annotate" revision="1">
+ <section id="validator-usingvalidator-annotate">
<title>Defining constraints</title>
<para>Constraints in Bean Validation are expressed via Java annotations.
@@ -391,7 +391,7 @@
</section>
</section>
- <section id="validator-usingvalidator-validate" revision="1">
+ <section id="validator-usingvalidator-validate">
<title>Validating constraints</title>
<para>The <classname>Validator</classname> interface is the main entry
@@ -666,7 +666,7 @@
</section>
</section>
- <section id="validator-usingvalidator-validationgroups" revision="1">
+ <section id="validator-usingvalidator-validationgroups">
<title>Validating groups</title>
<para>Groups allow you to restrict the set of constraints applied during
@@ -856,7 +856,7 @@
<para>Last but not least, we show that all constraints are passing by
validating against all defined groups.</para>
- <section revision="1">
+ <section>
<title>Group sequences</title>
<para>By default, constraints are evaluated in no particular order and
@@ -964,7 +964,7 @@
</section>
</section>
- <section id="validator-defineconstraints-builtin" revision="2">
+ <section id="validator-defineconstraints-builtin">
<title>Built-in constraints</title>
<para>Hibernate Validator implements all of the default constraints
14 years, 9 months
Hibernate SVN: r18937 - in validator/trunk/hibernate-validator/src: test/java/org/hibernate/validator/engine/serialization and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-03-08 16:52:30 -0500 (Mon, 08 Mar 2010)
New Revision: 18937
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/CustomConstraintSerializableTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/DummyEmailValidator.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/Email.java
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
Log:
HV-291 Made sure AnnotationProxy serializable. Note, it is still not guaranteed that the ConstraintViolation will be serializable since it might contain unserailizable information.
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java 2010-03-08 21:18:03 UTC (rev 18936)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/util/annotationfactory/AnnotationProxy.java 2010-03-08 21:52:30 UTC (rev 18937)
@@ -17,15 +17,15 @@
*/
package org.hibernate.validator.util.annotationfactory;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
-import java.util.Comparator;
+import java.security.AccessController;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
-import java.security.AccessController;
import org.hibernate.validator.util.GetDeclaredMethods;
@@ -53,21 +53,20 @@
* @author Davide Marchignoli
* @see java.lang.annotation.Annotation
*/
-public class AnnotationProxy implements Annotation, InvocationHandler {
+public class AnnotationProxy implements Annotation, InvocationHandler, Serializable {
+ private static final long serialVersionUID = 6907601010599429454L;
private final Class<? extends Annotation> annotationType;
- //FIXME it's probably better to use String as a key rather than Method
- // to speed up and avoid any fancy permsize/GC issue
- // I'd better check the litterature on the subject
- private final Map<Method, Object> values;
+ private final Map<String, Object> values;
+
public AnnotationProxy(AnnotationDescriptor descriptor) {
this.annotationType = descriptor.type();
values = getAnnotationValues( descriptor );
}
- private Map<Method, Object> getAnnotationValues(AnnotationDescriptor descriptor) {
- Map<Method, Object> result = new HashMap<Method, Object>();
+ private Map<String, Object> getAnnotationValues(AnnotationDescriptor descriptor) {
+ Map<String, Object> result = new HashMap<String, Object>();
int processedValuesFromDescriptor = 0;
GetDeclaredMethods action = GetDeclaredMethods.action( annotationType );
final Method[] declaredMethods;
@@ -79,25 +78,25 @@
}
for ( Method m : declaredMethods ) {
if ( descriptor.containsElement( m.getName() ) ) {
- result.put( m, descriptor.valueOf( m.getName() ) );
+ result.put( m.getName(), descriptor.valueOf( m.getName() ) );
processedValuesFromDescriptor++;
}
else if ( m.getDefaultValue() != null ) {
- result.put( m, m.getDefaultValue() );
+ result.put( m.getName(), m.getDefaultValue() );
}
else {
throw new IllegalArgumentException( "No value provided for " + m.getName() );
}
}
if ( processedValuesFromDescriptor != descriptor.numberOfElements() ) {
- throw new RuntimeException( "Trying to instanciate " + annotationType + " with unknown paramters." );
+ throw new RuntimeException( "Trying to instantiate " + annotationType + " with unknown paramters." );
}
return result;
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if ( values.containsKey( method ) ) {
- return values.get( method );
+ if ( values.containsKey( method.getName() ) ) {
+ return values.get( method.getName() );
}
return method.invoke( this, args );
}
@@ -109,8 +108,8 @@
public String toString() {
StringBuilder result = new StringBuilder();
result.append( '@' ).append( annotationType().getName() ).append( '(' );
- for ( Method m : getRegisteredMethodsInAlphabeticalOrder() ) {
- result.append( m.getName() ).append( '=' ).append( values.get( m ) ).append( ", " );
+ for ( String s : getRegisteredMethodsInAlphabeticalOrder() ) {
+ result.append( s ).append( '=' ).append( values.get( s ) ).append( ", " );
}
// remove last separator:
if ( values.size() > 0 ) {
@@ -124,15 +123,8 @@
return result.toString();
}
- private SortedSet<Method> getRegisteredMethodsInAlphabeticalOrder() {
- SortedSet<Method> result = new TreeSet<Method>(
- new Comparator<Method>() {
- public int compare(Method o1, Method o2) {
- return o1.getName().compareTo( o2.getName() );
- }
- }
- );
- //List<Method> result = new LinkedList<Method>();
+ private SortedSet<String> getRegisteredMethodsInAlphabeticalOrder() {
+ SortedSet<String> result = new TreeSet<String>();
result.addAll( values.keySet() );
return result;
}
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/CustomConstraintSerializableTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/CustomConstraintSerializableTest.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/CustomConstraintSerializableTest.java 2010-03-08 21:52:30 UTC (rev 18937)
@@ -0,0 +1,99 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.
+*/
+package org.hibernate.validator.engine.serialization;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Set;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.testng.annotations.Test;
+
+import org.hibernate.validator.util.TestUtil;
+
+
+/**
+ * A <b>sscce</b> (Short, Self Contained, Correct Example) showing that the
+ * simple custom Email validation constraint taken from <a href="http://blog.jteam.nl/2009/08/04/bean-validation-integrating-jsr-303-with-..."
+ * >this blog</a> gives a validation result that is not Serializable with
+ * Hibernate Validator 4.0.2.GA with underlying cause that
+ * <p/>
+ * <code>org.hibernate.validator.util.annotationfactory.AnnotationProxy</code>
+ * <p/>
+ * <p/>
+ * Note that Hibernate Validator does not guarantee at all that a
+ * {@link ConstraintViolation} is Serializable because an entity need not be
+ * Serializable, but otherwise there should not be much of a problem (right?).
+ *
+ * @author Henno Vermeulen
+ * @author Hardy Ferentschik
+ */
+public class CustomConstraintSerializableTest {
+
+ @Test
+ public void testSerializeHibernateEmail() throws Exception {
+ Validator validator = TestUtil.getValidator();
+
+ HibernateEmail invalidHibernateEmail = new HibernateEmail();
+ invalidHibernateEmail.email = "test@";
+
+ Set<ConstraintViolation<HibernateEmail>> constraintViolations = validator.validate( invalidHibernateEmail );
+ doSerialize( constraintViolations.iterator().next() );
+ }
+
+ /**
+ * HV-291
+ *
+ * @throws Exception in case the test fails
+ */
+ @Test
+ public void testSerializeCustomEmail() throws Exception {
+ Validator validator = TestUtil.getValidator();
+
+ CustomEmail invalidCustomEmail = new CustomEmail();
+ invalidCustomEmail.email = "test@";
+ Set<ConstraintViolation<CustomEmail>> constraintViolations = validator.validate( invalidCustomEmail );
+ doSerialize( constraintViolations.iterator().next() );
+ }
+
+ public static byte[] doSerialize(Object obj) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 );
+ ObjectOutputStream out = new ObjectOutputStream( baos );
+ out.writeObject( obj );
+ out.close();
+ return baos.toByteArray();
+ }
+
+ static class CustomEmail implements Serializable {
+ private static final long serialVersionUID = -9095271389455131159L;
+
+ @Email
+ String email;
+
+ }
+
+ static class HibernateEmail implements Serializable {
+ private static final long serialVersionUID = 7206154160792549270L;
+
+ @org.hibernate.validator.constraints.Email
+ String email;
+ }
+}
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/CustomConstraintSerializableTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/DummyEmailValidator.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/DummyEmailValidator.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/DummyEmailValidator.java 2010-03-08 21:52:30 UTC (rev 18937)
@@ -0,0 +1,35 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.
+*/
+package org.hibernate.validator.engine.serialization;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DummyEmailValidator implements ConstraintValidator<Email, String> {
+ public void initialize(Email annotation) {
+ }
+
+ public boolean isValid(String value, ConstraintValidatorContext context) {
+ return false;
+ }
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/DummyEmailValidator.java
___________________________________________________________________
Name: svn:keywords
+ Id
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/Email.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/Email.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/Email.java 2010-03-08 21:52:30 UTC (rev 18937)
@@ -0,0 +1,52 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* 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.
+*/
+package org.hibernate.validator.engine.serialization;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import javax.validation.ReportAsSingleViolation;
+import javax.validation.constraints.Pattern;
+
+/**
+ * Denotes that a field should contain a valid email address.
+ * <p/>
+ * <p/>
+ * Taken from <a href="http://blog.jteam.nl/2009/08/04/bean-validation-integrating-jsr-303-with-..."
+ * >this blog</a>.
+ *
+ * @author Hardy Ferentschik
+ */
+@Documented
+@Constraint(validatedBy = { DummyEmailValidator.class })
+@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
+(a)Retention(RetentionPolicy.RUNTIME)
+@Pattern(regexp = ".+@.+\\.[a-z]+")
+@ReportAsSingleViolation
+public @interface Email {
+
+ public abstract String message() default "{org.hibernate.validator.engine.serialization.Email.message}";
+
+ public abstract Class<?>[] groups() default { };
+
+ public abstract Class<? extends Payload>[] payload() default { };
+}
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/serialization/Email.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2010-03-08 21:18:03 UTC (rev 18936)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/util/TestUtil.java 2010-03-08 21:52:30 UTC (rev 18937)
@@ -118,7 +118,7 @@
actualMessages.add( violation.getMessage() );
}
- assertTrue( actualMessages.size() == messages.length, "Wrong number or error messages" );
+ assertTrue( actualMessages.size() == messages.length, "Wrong number of error messages" );
for ( String expectedMessage : messages ) {
assertTrue(
@@ -128,11 +128,11 @@
actualMessages.remove( expectedMessage );
}
assertTrue(
- actualMessages.isEmpty(), "Actual messages contained more messages as specidied expected messages"
+ actualMessages.isEmpty(), "Actual messages contained more messages as specified expected messages"
);
}
- public static <T> void assertCorrectConstraintTypes(Set<ConstraintViolation<T>> violations, Class<?>... expectedConsraintTypes) {
+ public static <T> void assertCorrectConstraintTypes(Set<ConstraintViolation<T>> violations, Class<?>... expectedConstraintTypes) {
List<String> actualConstraintTypes = new ArrayList<String>();
for ( ConstraintViolation<?> violation : violations ) {
actualConstraintTypes.add(
@@ -141,10 +141,10 @@
}
assertEquals(
- expectedConsraintTypes.length, actualConstraintTypes.size(), "Wrong number of constraint types."
+ expectedConstraintTypes.length, actualConstraintTypes.size(), "Wrong number of constraint types."
);
- for ( Class<?> expectedConstraintType : expectedConsraintTypes ) {
+ for ( Class<?> expectedConstraintType : expectedConstraintTypes ) {
assertTrue(
actualConstraintTypes.contains( expectedConstraintType.getName() ),
"The constraint type " + expectedConstraintType.getName() + " should have been violated."
14 years, 9 months
Hibernate SVN: r18936 - core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/lock.
by hibernate-commits@lists.jboss.org
Author: smarlow(a)redhat.com
Date: 2010-03-08 16:18:03 -0500 (Mon, 08 Mar 2010)
New Revision: 18936
Modified:
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/lock/LockTest.java
Log:
HHH-4972 javax.persistence.query.timeout and javax.persistence.lock.timeout can be passed when creating an EMF
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/lock/LockTest.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/lock/LockTest.java 2010-03-08 18:26:51 UTC (rev 18935)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/lock/LockTest.java 2010-03-08 21:18:03 UTC (rev 18936)
@@ -691,6 +691,92 @@
}
+ public void testLockTimeoutEMProps() throws Exception {
+
+ EntityManager em = getOrCreateEntityManager();
+ Map TimeoutProps = new HashMap();
+ TimeoutProps.put("javax.persistence.lock.timeout", new Integer(1000) ); // 1 second timeout
+ final EntityManager em2 = createIsolatedEntityManager(TimeoutProps);
+ // TODO: replace dialect instanceof test with a Dialect.hasCapability (e.g. supportsPessimisticLockTimeout)
+ if ( ! (getDialect() instanceof Oracle10gDialect)) {
+ log.info("skipping testLockTimeoutEMProps");
+ return;
+ }
+ Lock lock = new Lock();
+ Thread t = null;
+ FutureTask<Boolean> bgTask = null;
+ final CountDownLatch latch = new CountDownLatch(1);
+ try {
+ lock.setName( "testLockTimeoutEMProps" );
+
+ em.getTransaction().begin();
+ em.persist( lock );
+ em.getTransaction().commit();
+ em.clear();
+
+ em.getTransaction().begin();
+ lock = em.getReference( Lock.class, lock.getId() );
+ em.lock( lock, LockModeType.PESSIMISTIC_WRITE );
+ final Integer id = lock.getId();
+ lock.getName(); // force entity to be read
+ log.info("testLockTimeoutEMProps: got write lock");
+
+ bgTask = new FutureTask<Boolean>( new Callable() {
+ public Boolean call() {
+ try {
+ boolean timedOut = false; // true (success) if LockTimeoutException occurred
+ em2.getTransaction().begin();
+ log.info("testLockTimeoutEMProps: (BG) about to read write-locked entity");
+ // we should block on the following read
+ Lock lock2 = em2.getReference( Lock.class, id );
+ lock2.getName(); // force entity to be read
+ log.info("testLockTimeoutEMProps: (BG) read write-locked entity");
+ // em2 already has javax.persistence.lock.timeout of 1 second applied
+ try {
+ em2.lock( lock2, LockModeType.PESSIMISTIC_WRITE);
+ }
+ catch( LockTimeoutException e) {
+ // success
+ log.info("testLockTimeoutEMProps: (BG) got expected timeout exception");
+ timedOut = true;
+ }
+ catch ( Throwable e) {
+ log.info("Expected LockTimeoutException but got unexpected exception", e);
+ }
+ em2.getTransaction().commit();
+ return new Boolean(timedOut);
+ }
+ finally {
+ latch.countDown(); // signal that we finished
+ }
+ }
+ } );
+ t = new Thread(bgTask);
+ t.setDaemon( true );
+ t.setName("Lock timeout Test (bg)");
+ t.start();
+ boolean latchSet = latch.await( 10, TimeUnit.SECONDS ); // should return quickly on success
+ assertTrue( "background test thread finished (lock timeout is broken)", latchSet);
+ assertTrue( "background test thread timed out on lock attempt", bgTask.get().booleanValue() );
+ em.getTransaction().commit();
+ }
+ finally {
+ if ( em.getTransaction().isActive() ) {
+ em.getTransaction().rollback();
+ }
+ if ( t != null) { // wait for background thread to finish before deleting entity
+ t.join();
+ }
+ em.getTransaction().begin();
+ lock = em.getReference( Lock.class, lock.getId() );
+ em.remove( lock );
+ em.getTransaction().commit();
+ em.close();
+ em2.close();
+ }
+ }
+
+
public Class[] getAnnotatedClasses() {
return new Class[]{
Lock.class,
14 years, 9 months
Hibernate SVN: r18935 - annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/cid.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-03-08 13:26:51 -0500 (Mon, 08 Mar 2010)
New Revision: 18935
Modified:
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java
Log:
JBPAPP-3223 HHH-3164 'id in ...' with EmbeddedId and criteria API
Modified: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java 2010-03-08 18:24:20 UTC (rev 18934)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java 2010-03-08 18:26:51 UTC (rev 18935)
@@ -265,7 +265,8 @@
}
public void testQueryInAndComposite() {
- if(Dialect.getDialect() instanceof HSQLDialect){
+ //HHH-4907
+ if(!Dialect.getDialect().supportsRowValueConstructorSyntaxInInList()){
return;
}
Session s = openSession( );
14 years, 9 months
Hibernate SVN: r18934 - core/trunk/annotations/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-03-08 13:24:20 -0500 (Mon, 08 Mar 2010)
New Revision: 18934
Modified:
core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
core/trunk/annotations/src/main/docbook/en/modules/entity.xml
core/trunk/annotations/src/main/docbook/en/modules/setup.xml
core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
Log:
HHH-4933 use jHighlighter to align with core
Modified: core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml 2010-03-08 17:56:55 UTC (rev 18933)
+++ core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml 2010-03-08 18:24:20 UTC (rev 18934)
@@ -122,7 +122,7 @@
<literal>ddl</literal> together by setting the property to
<literal>callback, dll</literal></para>
- <programlisting><persistence ...>
+ <programlisting role="XML" language="XML"><persistence ...>
<persistence-unit ...>
...
<properties>
@@ -171,15 +171,15 @@
<example>
<title>Using custom groups for validation</title>
- <programlisting><persistence ...>
+ <programlisting role="XML" language="XML"><persistence ...>
<persistence-unit ...>
...
<properties>
- <property name="<literal>javax.persistence.validation.group.pre-update</literal>"
+ <property name="javax.persistence.validation.group.pre-update"
value="javax.validation.group.Default, com.acme.group.Strict"/>
- <property name="<literal>javax.persistence.validation.group.pre-remove</literal>"
+ <property name="javax.persistence.validation.group.pre-remove"
value="com.acme.group.OnDelete"/>
- <property name="<literal>org.hibernate.validator.group.ddl</literal>"
+ <property name="org.hibernate.validator.group.ddl"
value="com.acme.group.DDL"/>
</properties>
</persistence-unit>
Modified: core/trunk/annotations/src/main/docbook/en/modules/entity.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-08 17:56:55 UTC (rev 18933)
+++ core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-08 18:24:20 UTC (rev 18934)
@@ -63,7 +63,7 @@
<para>Every persistent POJO class is an entity and is declared using the
<literal>@Entity</literal> annotation (at the class level):</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Flight implements Serializable {
Long id;
@@ -102,7 +102,7 @@
mapping. If no <literal>@Table</literal> is defined the default values
are used: the unqualified class name of the entity.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Table(name="tbl_sky")
public class Sky implements Serializable {
...
@@ -117,8 +117,8 @@
<code>@Column.unique</code> approach (refer to
<literal>@Column</literal> for more information).</para>
- <programlisting>@Table(name="tbl_sky",
- <emphasis role="bold">uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}</emphasis>
+ <programlisting role="JAVA" language="JAVA">@Table(name="tbl_sky",
+ uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}
)</programlisting>
<para>A unique constraint is applied to the tuple month, day. Note
@@ -142,7 +142,7 @@
<para>You can add optimistic locking capability to an entity using the
<literal>@Version</literal> annotation:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Flight implements Serializable {
...
@Version
@@ -182,7 +182,7 @@
annotation allows you to declare the fetching strategy for a
property:</para>
- <programlisting>public transient int counter; //transient property
+ <programlisting role="JAVA" language="JAVA">public transient int counter; //transient property
private String firstname; //persistent property
@@ -252,7 +252,7 @@
<classname>byte[] </classname>and serializable type will be persisted
in a Blob.</para>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
@Lob
public String getFullText() {
return fullText;
@@ -313,7 +313,7 @@
<para>To force the access type on a given class, use the
<classname>@Access</classname> annotation as showed below:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Order {
@Id private Long id;
public Long getId() { return id; }
@@ -348,7 +348,7 @@
<para>You can also override the access type of a single property while
keeping the other properties standard.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Order {
@Id private Long id;
public Long getId() { return id; }
@@ -408,7 +408,7 @@
</listitem>
</itemizedlist>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
@Entity
public class Flight implements Serializable {
...
@@ -448,7 +448,7 @@
<area coords="11 55" id="hm10" />
</areaspec>
- <programlisting>@Column(
+ <programlisting role="JAVA" language="JAVA">@Column(
name="columnName";
boolean unique() default false;
boolean nullable() default true;
@@ -528,7 +528,7 @@
<literal>@Embedded</literal> and <literal>@AttributeOverride</literal>
annotation in the associated property:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Person implements Serializable {
// Persistent component using defaults
@@ -543,13 +543,13 @@
...
} </programlisting>
- <programlisting>@Embeddable
+ <programlisting role="JAVA" language="JAVA">@Embeddable
public class Address implements Serializable {
String city;
Country nationality; //no overriding here
} </programlisting>
- <programlisting>@Embeddable
+ <programlisting role="JAVA" language="JAVA">@Embeddable
public class Country implements Serializable {
private String iso2;
@Column(name="countryName") private String name;
@@ -582,14 +582,14 @@
columns of embedded objects of embedded objects is through dotted
expressions.</para>
- <para><programlisting> @Embedded
+ <programlisting role="JAVA" language="JAVA"> @Embedded
@AttributeOverrides( {
@AttributeOverride(name="city", column = @Column(name="fld_city") ),
- @AttributeOverride(name="<emphasis role="bold">nationality.iso2</emphasis>", column = @Column(name="nat_Iso2") ),
- @AttributeOverride(name="<emphasis role="bold">nationality.name</emphasis>", column = @Column(name="nat_CountryName") )
+ @AttributeOverride(name="nationality.iso2", column = @Column(name="nat_Iso2") ),
+ @AttributeOverride(name="nationality.name", column = @Column(name="nat_CountryName") )
//nationality columns in homeAddress are overridden
} )
- Address homeAddress;</programlisting>Hibernate Annotations supports
+ Address homeAddress;</programlisting><para>Hibernate Annotations supports
something that is not explicitly supported by the JPA specification.
You can annotate a embedded object with the
<literal>@MappedSuperclass</literal> annotation to make the superclass
@@ -691,12 +691,12 @@
<para>The following example shows a sequence generator using the
SEQ_STORE configuration (see below)</para>
- <programlisting>@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
+ <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
public Integer getId() { ... } </programlisting>
<para>The next example uses the identity generator:</para>
- <programlisting>@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
+ <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() { ... } </programlisting>
<para>The <literal>AUTO</literal> generator is the preferred type for
@@ -711,7 +711,7 @@
Application level generators are defined at XML level (see <xref
linkend="xml-overriding" />):</para>
- <programlisting><table-generator name="EMP_GEN"
+ <programlisting role="JAVA" language="JAVA"><table-generator name="EMP_GEN"
table="GENERATOR_TABLE"
pk-column-name="key"
value-column-name="hi"
@@ -782,7 +782,7 @@
<para>The next example shows the definition of a sequence generator in
a class scope:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@javax.persistence.SequenceGenerator(
name="SEQ_STORE",
sequenceName="my_sequence"
@@ -805,9 +805,9 @@
foreign generator but the JPA mapping reads better and is
encouraged.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class MedicalHistory implements Serializable {
- <emphasis role="bold">@Id @OneToOne</emphasis>
+ @Id @OneToOne
@JoinColumn(name = "person_id")
Person patient;
}
@@ -819,11 +819,11 @@
<para>Or alternatively</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class MedicalHistory implements Serializable {
@Id Integer id;
- <emphasis role="bold">@MapsId @OneToOne</emphasis>
+ @MapsId @OneToOne
@JoinColumn(name = "patient_id")
Person patient;
}
@@ -891,11 +891,11 @@
<para>Here is a simple example of
<classname>@EmbeddedId</classname>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class User {
- <emphasis role="bold" security="">@EmbeddedId
+ @EmbeddedId
@AttributeOverride(name="firstName", column=@Column(name="fld_firstname")
- UserId id;</emphasis>
+ UserId id;
Integer age;
}
@@ -913,22 +913,22 @@
<para>An embedded id can itself contains the primary key of an
associated entity.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class Customer {
@EmbeddedId CustomerId id;
boolean preferredCustomer;
- <emphasis role="bold">@MapsId("userId")
+ @MapsId("userId")
@JoinColumns({
@JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
@JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
})
- @OneToOne User user;</emphasis>
+ @OneToOne User user;
}
@Embeddable
class CustomerId implements Serializable {
- <emphasis role="bold">UserId userId;</emphasis>
+ UserId userId;
String customerNumber;
}
@@ -969,7 +969,7 @@
association directly in the embedded id component (instead of having
to use the <classname>@MapsId</classname> annotation).</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class Customer {
@EmbeddedId CustomerId id;
boolean preferredCustomer;
@@ -977,12 +977,12 @@
@Embeddable
class CustomerId implements Serializable {
- <emphasis role="bold">@OneToOne
+ @OneToOne
@JoinColumns({
@JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
@JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
})
- User user;</emphasis>
+ User user;
String customerNumber;
}
@@ -1007,16 +1007,16 @@
approach is only supported by Hibernate but does not require an
extra embeddable component.</para>
- <programlisting>@Entity
-class Customer <emphasis role="bold">implements Serializable </emphasis>{
- <emphasis role="bold">@Id @OneToOne
+ <programlisting role="JAVA" language="JAVA">@Entity
+class Customer implements Serializable {
+ @Id @OneToOne
@JoinColumns({
@JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
@JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
})
- User user;</emphasis>
+ User user;
- <emphasis role="bold">@Id</emphasis> String customerNumber;
+ @Id String customerNumber;
boolean preferredCustomer;
}
@@ -1055,22 +1055,22 @@
and Hibernate supports it.</para>
</warning>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class Customer {
- <emphasis role="bold">@Id @OneToOne
+ @Id @OneToOne
@JoinColumns({
@JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
@JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
})
- User user;</emphasis>
+ User user;
- <emphasis role="bold">@Id</emphasis> String customerNumber;
+ @Id String customerNumber;
boolean preferredCustomer;
}
class CustomerId implements Serializable {
- <emphasis role="bold">UserId user;</emphasis>
+ UserId user;
String customerNumber;
}
@@ -1095,22 +1095,22 @@
vanilla associated property in the
<classname>@IdClass</classname>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
class Customer {
- <emphasis role="bold">@Id @OneToOne
+ @Id @OneToOne
@JoinColumns({
@JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
@JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
})
- User user;</emphasis>
+ User user;
- <emphasis role="bold">@Id</emphasis> String customerNumber;
+ @Id String customerNumber;
boolean preferredCustomer;
}
class CustomerId implements Serializable {
- <emphasis role="bold">@OneToOne User user;</emphasis>
+ @OneToOne User user;
String customerNumber;
}
@@ -1141,7 +1141,7 @@
this feature.</para>
</warning>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class CustomerInventory implements Serializable {
@Id
@TableGenerator(name = "inventory",
@@ -1150,7 +1150,7 @@
valueColumnName = "S_NEXTNUM",
pkColumnValue = "inventory",
allocationSize = 1000)
- <emphasis role="bold">@GeneratedValue(strategy = GenerationType.TABLE, generator = "inventory")</emphasis>
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "inventory")
Integer id;
@@ -1210,7 +1210,7 @@
UNION</literal> queries. It is commonly used for the top level of an
inheritance hierarchy:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Flight implements Serializable { ... } </programlisting>
@@ -1229,7 +1229,7 @@
same table, instances are distinguished by a special discriminator
column:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="planetype",
@@ -1269,7 +1269,7 @@
<literal>@PrimaryKeyJoinColumns</literal> annotations define the
primary key(s) of the joined subclass table:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Boat implements Serializable { ... }
@@ -1296,7 +1296,7 @@
mapped entity (ie no specific table for this entity). For that purpose
you can map them as <literal>@MappedSuperclass</literal>.</para>
- <programlisting>@MappedSuperclass
+ <programlisting role="JAVA" language="JAVA">@MappedSuperclass
public class BaseEntity {
@Basic
@Temporal(TemporalType.TIMESTAMP)
@@ -1351,7 +1351,7 @@
root entity level using the <literal>@AttributeOverride</literal>
annotation.</para>
- <programlisting>@MappedSuperclass
+ <programlisting role="JAVA" language="JAVA">@MappedSuperclass
public class FlyingObject implements Serializable {
public int getAltitude() {
@@ -1412,7 +1412,7 @@
<para>First, we map a real one-to-one association using shared primary
keys:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Body {
@Id
public Long getId() { return id; }
@@ -1425,7 +1425,7 @@
...
} </programlisting>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Heart {
@Id
public Long getId() { ...}
@@ -1438,17 +1438,17 @@
<para>In the following example, the associated entities are linked
through an explicit foreign key column:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer implements Serializable {
@OneToOne(cascade = CascadeType.ALL)
- <emphasis role="bold">@JoinColumn(name="passport_fk")</emphasis>
+ @JoinColumn(name="passport_fk")
public Passport getPassport() {
...
}
@Entity
public class Passport implements Serializable {
- @OneToOne(<emphasis role="bold">mappedBy = "passport"</emphasis>)
+ @OneToOne(mappedBy = "passport")
public Customer getOwner() {
...
} </programlisting>
@@ -1492,12 +1492,12 @@
<para>The third possibility (using an association table) is quite
exotic.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer implements Serializable {
@OneToOne(cascade = CascadeType.ALL)
- <emphasis role="bold">@JoinTable(name = "CustomerPassports",
+ @JoinTable(name = "CustomerPassports",
joinColumns = @JoinColumn(name="customer_fk"),
- inverseJoinColumns = @JoinColumn(name="passport_fk")</emphasis>
+ inverseJoinColumns = @JoinColumn(name="passport_fk")
)
public Passport getPassport() {
...
@@ -1505,7 +1505,7 @@
@Entity
public class Passport implements Serializable {
- @OneToOne(<emphasis role="bold">mappedBy = "passport"</emphasis>)
+ @OneToOne(mappedBy = "passport")
public Customer getOwner() {
...
} </programlisting>
@@ -1530,9 +1530,9 @@
<para>Many-to-one associations are declared at the property level with
the annotation <literal>@ManyToOne</literal>:</para>
- <programlisting>@Entity()
+ <programlisting role="JAVA" language="JAVA">@Entity()
public class Flight implements Serializable {
- <emphasis role="bold">@ManyToOne</emphasis>( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
+ @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
@JoinColumn(name="COMP_ID")
public Company getCompany() {
return company;
@@ -1555,10 +1555,9 @@
almost all cases. However this is useful when you want to use
interfaces as the return type instead of the regular entity.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Flight implements Serializable {
- @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, <emphasis
- role="bold">targetEntity=CompanyImpl.class</emphasis> )
+ @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, targetEntity=CompanyImpl.class )
@JoinColumn(name="COMP_ID")
public Company getCompany() {
return company;
@@ -1578,13 +1577,13 @@
referencing the target entity table (through
<literal>@JoinTable.inverseJoinColumns</literal>).</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Flight implements Serializable {
@ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
- <emphasis role="bold">@JoinTable(name="Flight_Company",
+ @JoinTable(name="Flight_Company",
joinColumns = @JoinColumn(name="FLIGHT_ID"),
inverseJoinColumns = @JoinColumn(name="COMP_ID")
- )</emphasis>
+ )
public Company getCompany() {
return company;
}
@@ -1620,7 +1619,7 @@
association is annotated by
<literal>@OneToMany(mappedBy=...)</literal></para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Troop {
@OneToMany(mappedBy="troop")
public Set<Soldier> getSoldiers() {
@@ -1648,7 +1647,7 @@
false. This solution is not optimized and will produce some
additional UPDATE statements.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Troop {
@OneToMany
@JoinColumn(name="troop_fk") //we need to duplicate the physical information
@@ -1675,7 +1674,7 @@
association is described through a
<literal>@JoinColumn</literal></para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer implements Serializable {
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@@ -1700,7 +1699,7 @@
preferred. This association is described through an
<literal>@JoinTable</literal>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Trainer {
@OneToMany
@JoinTable(
@@ -1741,7 +1740,7 @@
added to the foreign key referencing the other side table to
reflect the one to many.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Trainer {
@OneToMany
public Set<Tiger> getTrainedTigers() {
@@ -1777,7 +1776,7 @@
the inverse end (ie. it will be ignored when updating the
relationship values in the association table):</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Employer implements Serializable {
@ManyToMany(
targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,
@@ -1794,7 +1793,7 @@
...
} </programlisting>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Employee implements Serializable {
@ManyToMany(
cascade = {CascadeType.PERSIST, CascadeType.MERGE},
@@ -1836,7 +1835,7 @@
and the other side primary key column(s). These are the same rules
used for a unidirectional one to many relationship.</para>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
@Entity
public class Store {
@ManyToMany(cascade = CascadeType.PERSIST)
@@ -1868,7 +1867,7 @@
the other side primary key column(s). These are the same rules
used for a unidirectional one to many relationship.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Store {
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
public Set<Customer> getCustomers() {
@@ -1900,7 +1899,7 @@
objects. Use the <classname>@ElementCollection</classname> in this
case.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class User {
[...]
public String getLastname() { ...}
@@ -1928,7 +1927,7 @@
embeddable object in the collection table, use the
<classname>@AttributeOverride</classname> annotation.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class User {
[...]
public String getLastname() { ...}
@@ -1957,7 +1956,7 @@
<literal>key.</literal> prefix to override properties of the
embeddable object used in the map key.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class User {
@ElementCollection
@AttributeOverrides({
@@ -2000,14 +1999,14 @@
collection will be ordered by the primary key of the target
entity.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany(mappedBy="customer")
- <emphasis role="bold">@OrderBy("number")</emphasis>
+ @OrderBy("number")
public List<Order> getOrders() { return orders; }
public void setOrders(List<Order> orders) { this.orders = orders; }
private List<Order> orders;
@@ -2048,14 +2047,14 @@
<literal>ORDER</literal> (in the following example, it would be
<literal>orders_ORDER</literal>).</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany(mappedBy="customer")
- <emphasis role="bold">@OrderColumn(name"orders_index")</emphasis>
+ @OrderColumn(name"orders_index")
public List<Order> getOrders() { return orders; }
public void setOrders(List<Order> orders) { this.orders = orders; }
private List<Order> orders;
@@ -2113,14 +2112,14 @@
other words, if you change the property value, the key will not
change automatically in your Java model.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany(mappedBy="customer")
- <emphasis role="bold">@MapKey(name"number")</emphasis>
+ @MapKey(name"number")
public Map<String,Order> getOrders() { return orders; }
public void setOrders(Map<String,Order> order) { this.orders = orders; }
private Map<String,Order> orders;
@@ -2188,14 +2187,14 @@
should wonder why at this day and age you don't use
generics).</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany @JoinTable(name="Cust_Order")
- <emphasis role="bold">@MapKeyColumn(name"orders_number")</emphasis>
+ @MapKeyColumn(name"orders_number")
public Map<String,Order> getOrders() { return orders; }
public void setOrders(Map<String,Order> orders) { this.orders = orders; }
private Map<String,Order> orders;
@@ -2376,7 +2375,7 @@
to true. In a way, it means that the associated entity's lifecycle is
bound to the owning entity just like an embeddable object is.</para>
- <programlisting>@Entity class Customer {
+ <programlisting role="JAVA" language="JAVA">@Entity class Customer {
@OneToMany(orphanRemoval=true) public Set<Order> getOrders() { return orders; }
public void setOrders(Set<Order> orders) { this.orders = orders; }
private Set<Order> orders;
@@ -2429,7 +2428,7 @@
You can also use <literal>@IdClass</literal>. These are more detailed in
<xref linkend="entity-mapping-identifier" />.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class RegionalArticle implements Serializable {
@Id
@@ -2441,7 +2440,7 @@
<para>or alternatively</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class RegionalArticle implements Serializable {
@EmbeddedId
@@ -2459,7 +2458,7 @@
explicitly. Otherwise, Hibernate will suppose that you use the same
order of columns as in the primary key declaration.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Parent implements Serializable {
@Id
public ParentPk id;
@@ -2475,7 +2474,7 @@
...
} </programlisting>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Child implements Serializable {
@Id @GeneratedValue
public Integer id;
@@ -2489,7 +2488,7 @@
public Parent parent; //unidirectional
} </programlisting>
- <programlisting>@Embeddable
+ <programlisting role="JAVA" language="JAVA">@Embeddable
public class ParentPk implements Serializable {
String firstName;
String lastName;
@@ -2510,14 +2509,14 @@
parameter of <literal>@Column</literal> or
<literal>@JoinColumn</literal>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Table(name="MainCat")
-<emphasis role="bold">@SecondaryTables({
+@SecondaryTables({
@SecondaryTable(name="Cat1", pkJoinColumns={
@PrimaryKeyJoinColumn(name="cat_id", referencedColumnName="id")
),
@SecondaryTable(name="Cat2", uniqueConstraints={@UniqueConstraint(columnNames={"storyPart2"})})
-})</emphasis>
+})
public class Cat implements Serializable {
private Integer id;
@@ -2534,12 +2533,12 @@
return name;
}
- <emphasis role="bold">@Column(table="Cat1")</emphasis>
+ @Column(table="Cat1")
public String getStoryPart1() {
return storyPart1;
}
- <emphasis role="bold">@Column(table="Cat2")</emphasis>
+ @Column(table="Cat2")
public String getStoryPart2() {
return storyPart2;
}
@@ -2624,7 +2623,7 @@
that.</para>
</note>
- <programlisting>@Entity @Cacheable
+ <programlisting role="JAVA" language="JAVA">@Entity @Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Forest { ... }</programlisting>
@@ -2633,7 +2632,7 @@
<classname>@Cache</classname> annotation on the collection
property.</para>
- <programlisting>@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ <programlisting role="JAVA" language="JAVA">@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public SortedSet<Ticket> getTickets() {
@@ -2652,7 +2651,7 @@
<area coords="4 55" id="cache-hm3" />
</areaspec>
- <programlisting>@Cache(
+ <programlisting role="JAVA" language="JAVA">@Cache(
CacheConcurrencyStrategy usage();
String region() default "";
String include() default "all";
@@ -2709,7 +2708,7 @@
manager factory scope. A named query is defined by its name and the
actual query string.</para>
- <programlisting><entity-mappings>
+ <programlisting role="JAVA" language="JAVA"><entity-mappings>
<named-query name="plane.getAll">
<query>select p from Plane p</query>
</named-query>
@@ -2739,7 +2738,6 @@
<para>The available Hibernate hints are</para>
- <para></para>
<table>
<title>Query hints</title>
@@ -2839,10 +2837,10 @@
definitions are optional provided that they map to the same column name
as the one declared on the class property.</para>
- <para><programlisting>@NamedNativeQuery(name="night&area", query="select night.id nid, night.night_duration, "
+ <programlisting role="JAVA" language="JAVA">@NamedNativeQuery(name="night&area", query="select night.id nid, night.night_duration, "
+ " night.night_date, area.id aid, night.area_id, area.name "
+ "from Night night, Area area where night.area_id = area.id",
- <emphasis role="bold">resultSetMapping="joinMapping"</emphasis>)
+ resultSetMapping="joinMapping")
@SqlResultSetMapping(name="joinMapping", entities={
@EntityResult(entityClass=Night.class, fields = {
@FieldResult(name="id", column="nid"),
@@ -2856,7 +2854,7 @@
@FieldResult(name="name", column="name")
})
}
-)</programlisting></para>
+)</programlisting>
<para>In the above example, the <literal>night&area</literal> named
query use the <literal>joinMapping</literal> result set mapping. This
@@ -2865,12 +2863,12 @@
column name, actually the column name retrieved by the query. Let's now
see an implicit declaration of the property / column.</para>
- <programlisting>@Entity
-<emphasis role="bold">@SqlResultSetMapping(name="implicit",
+ <programlisting role="JAVA" language="JAVA">@Entity
+@SqlResultSetMapping(name="implicit",
entities=(a)EntityResult(entityClass=SpaceShip.class))
@NamedNativeQuery(name="implicitSample",
query="select * from SpaceShip",
- resultSetMapping="implicit")</emphasis>
+ resultSetMapping="implicit")
public class SpaceShip {
private String name;
private String model;
@@ -2913,15 +2911,15 @@
property name for the relationship, followed by a dot ("."), followed by
the name or the field or property of the primary key.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@SqlResultSetMapping(name="compositekey",
entities=(a)EntityResult(entityClass=SpaceShip.class,
fields = {
@FieldResult(name="name", column = "name"),
@FieldResult(name="model", column = "model"),
@FieldResult(name="speed", column = "speed"),
-<emphasis role="bold"> @FieldResult(name="captain.firstname", column = "firstn"),
- @FieldResult(name="captain.lastname", column = "lastn"),</emphasis>
+ @FieldResult(name="captain.firstname", column = "firstn"),
+ @FieldResult(name="captain.lastname", column = "lastn"),
@FieldResult(name="dimensions.length", column = "length"),
@FieldResult(name="dimensions.width", column = "width")
}),
@@ -3016,8 +3014,8 @@
mapping, you can use the <literal>resultClass</literal> attribute
instead of <literal>resultSetMapping</literal>:</para>
- <programlisting><emphasis role="bold">@NamedNativeQuery(name="implicitSample", query="select * from SpaceShip",
- resultClass=SpaceShip.class)</emphasis>
+ <programlisting role="JAVA" language="JAVA">@NamedNativeQuery(name="implicitSample", query="select * from SpaceShip",
+ resultClass=SpaceShip.class)
public class SpaceShip {</programlisting>
<para>In some of your native queries, you'll have to return scalar
@@ -3027,8 +3025,8 @@
and scalar returns in the same native query (this is probably not that
common though).</para>
- <programlisting><emphasis role="bold">@SqlResultSetMapping(name="scalar", columns=@ColumnResult(name="dimension"))
-@NamedNativeQuery(name="scalar", query="select length*width as dimension from SpaceShip", resultSetMapping="scalar")</emphasis></programlisting>
+ <programlisting role="JAVA" language="JAVA">@SqlResultSetMapping(name="scalar", columns=@ColumnResult(name="dimension"))
+@NamedNativeQuery(name="scalar", query="select length*width as dimension from SpaceShip", resultSetMapping="scalar")</programlisting>
<para>An other query hint specific to native queries has been
introduced: <literal>org.hibernate.callable</literal> which can be true
@@ -3189,7 +3187,7 @@
implements persistence via, for example, stored procedure calls,
serialization to flat files or LDAP.</para>
- <para><programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@BatchSize(size=5)
@org.hibernate.annotations.Entity(
selectBeforeUpdate = true,
@@ -3199,7 +3197,7 @@
@Where(clause="1=1")
@org.hibernate.annotations.Table(name="Forest", indexes = { @Index(name="idx", columnNames = { "name", "length" } ) } )
@Persister(impl=MyEntityPersister.class)
-public class Forest { ... }</programlisting> <programlisting>@Entity
+public class Forest { ... }</programlisting> <programlisting role="JAVA" language="JAVA">@Entity
@Inheritance(
strategy=InheritanceType.JOINED
)
@@ -3207,7 +3205,7 @@
@Entity
@OnDelete(action=OnDeleteAction.CASCADE)
-public class Carrot extends Vegetable { ... }</programlisting></para>
+public class Carrot extends Vegetable { ... }</programlisting>
</section>
<section id="entity-hibspec-identifier">
@@ -3224,7 +3222,7 @@
allows you to define an Hibernate specific id
generator.</literal></para>
- <para><programlisting>@Id @GeneratedValue(generator="system-uuid")
+ <programlisting role="JAVA" language="JAVA">@Id @GeneratedValue(generator="system-uuid")
@GenericGenerator(name="system-uuid", strategy = "uuid")
public String getId() {
@@ -3235,7 +3233,7 @@
@Parameter(name="sequence", value="heybabyhey")
}
)
-public Integer getId() {</programlisting></para>
+public Integer getId() {</programlisting>
<para><literal>strategy</literal> is the short name of an Hibernate3
generator strategy or the fully qualified class name of an
@@ -3249,7 +3247,7 @@
annotations, making them application level generators (just like if
they were in a JPA XML file).</para>
- <programlisting>@GenericGenerators(
+ <programlisting role="JAVA" language="JAVA">@GenericGenerators(
{
@GenericGenerator(
name="hibseq",
@@ -3277,7 +3275,7 @@
composed of all the properties marked
<classname>@NaturalId</classname>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Citizen {
@Id
@GeneratedValue
@@ -3319,7 +3317,7 @@
property into a column. This kind of property is read only (its value
is calculated by your formula fragment).</para>
- <programlisting>@Formula("obj_length * obj_height * obj_width")
+ <programlisting role="JAVA" language="JAVA">@Formula("obj_length * obj_height * obj_width")
public long getObjectVolume()</programlisting>
<para>The SQL fragment can be as complex as you want and even include
@@ -3355,7 +3353,7 @@
Place your annotations before the package declaration.</para>
</note>
- <programlisting>@TypeDef(
+ <programlisting role="JAVA" language="JAVA">@TypeDef(
name = "phoneNumber",
defaultForType = PhoneNumber.class,
typeClass = PhoneNumberType.class
@@ -3374,7 +3372,7 @@
<literal>parameters</literal> attribute to customize the
TypeDef.</para>
- <programlisting>//in org/hibernate/test/annotations/entity/package-info.java
+ <programlisting role="JAVA" language="JAVA">//in org/hibernate/test/annotations/entity/package-info.java
@TypeDefs(
{
@TypeDef(
@@ -3399,7 +3397,7 @@
definitions. The <literal>@Columns</literal> has been introduced for
that purpose.</para>
- <programlisting>@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
+ <programlisting role="JAVA" language="JAVA">@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
@Columns(columns = {
@Column(name="r_amount"),
@Column(name="r_currency")
@@ -3423,7 +3421,7 @@
<literal>@Index</literal> annotation on a one column property, the
columnNames attribute will then be ignored</para>
- <programlisting>@Column(secondaryTable="Cat1")
+ <programlisting role="JAVA" language="JAVA">@Column(secondaryTable="Cat1")
@Index(name="story1index")
public String getStoryPart1() {
return storyPart1;
@@ -3436,7 +3434,7 @@
<para>When inside an embeddable object, you can define one of the
properties as a pointer back to the owner element.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Person {
@Embeddable public Address address;
...
@@ -3459,7 +3457,7 @@
database. Hibernate can deal with such properties and triggers a
subsequent select to read these properties.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Antenna {
@Id public Integer id;
@Generated(GenerationTime.ALWAYS)
@@ -3493,8 +3491,8 @@
<literal>targetEntity</literal> attribute available on
associations.</para>
- <programlisting> @Embedded
- <emphasis role="bold">@Target(OwnerImpl.class)</emphasis>
+ <programlisting role="JAVA" language="JAVA"> @Embedded
+ @Target(OwnerImpl.class)
public Owner getOwner() {
return owner;
}</programlisting>
@@ -3525,8 +3523,8 @@
formula for discriminator resolution (no need to have a dedicated
column).</para>
- <programlisting>@Entity
-<emphasis role="bold">@DiscriminatorFormula("case when forest_type is null then 0 else forest_type end")</emphasis>
+ <programlisting role="JAVA" language="JAVA">@Entity
+@DiscriminatorFormula("case when forest_type is null then 0 else forest_type end")
public class Forest { ... }</programlisting>
<para>By default, when querying the top entities, Hibernate does not put
@@ -3540,7 +3538,7 @@
<para>You can define the foreign key name generated by Hibernate for
subclass tables in the JOINED inheritance strategy.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class File { ... }
@@ -3566,7 +3564,7 @@
<literal>@ManyToOne</literal>, <literal>@OneToMany</literal> or
<literal>@ManyToMany</literal> association.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Child {
...
@ManyToOne
@@ -3578,7 +3576,7 @@
<para>Sometimes you want to delegate to your database the deletion of
cascade when a given entity is deleted.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Child {
...
@ManyToOne
@@ -3594,11 +3592,11 @@
fairly unreadable name. You can override the constraint name by use
<literal>@ForeignKey</literal>.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Child {
...
@ManyToOne
- <emphasis role="bold">@ForeignKey(name="FK_PARENT")</emphasis>
+ @ForeignKey(name="FK_PARENT")
public Parent getParent() { ... }
...
}
@@ -3724,7 +3722,7 @@
<classname>@AnyDef</classname> and <classname>@AnyDefs</classname>
annotations are used.</para>
- <programlisting> @Any( metaColumn = @Column( name = "property_type" ), fetch=FetchType.EAGER )
+ <programlisting role="JAVA" language="JAVA"> @Any( metaColumn = @Column( name = "property_type" ), fetch=FetchType.EAGER )
@AnyMetaDef(
idType = "integer",
metaType = "string",
@@ -3745,7 +3743,7 @@
reused. It is recommended to place it as a package metadata in this
case.</para>
- <programlisting>//on a package
+ <programlisting role="JAVA" language="JAVA">//on a package
@AnyMetaDef( name="property"
idType = "integer",
metaType = "string",
@@ -3818,7 +3816,7 @@
<classname>SortedSet</classname> or a <classname>SortedMap</classname>
interface.</para>
- <programlisting> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
+ <programlisting role="JAVA" language="JAVA"> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name="CUST_ID")
@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)
@Where(clause="1=1")
@@ -3837,11 +3835,11 @@
<literal>inverseName</literal> referencing to the other side
constraint.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Woman {
...
@ManyToMany(cascade = {CascadeType.ALL})
- <emphasis role="bold">@ForeignKey(name = "TO_WOMAN_FK", inverseName = "TO_MAN_FK")</emphasis>
+ @ForeignKey(name = "TO_WOMAN_FK", inverseName = "TO_MAN_FK")
public Set<Man> getMens() {
return mens;
}
@@ -3863,7 +3861,7 @@
associated class explicitly maps the indexed value, the use of
<methodname>mappedBy</methodname> is permitted:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Parent {
@OneToMany(mappedBy="parent")
@OrderColumn(name="order")
@@ -3891,7 +3889,7 @@
the collection as <literal>mappedBy</literal>. Instead, we could use
the following mapping:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
public class Parent {
@OneToMany
@OrderColumn(name="order")
@@ -3927,18 +3925,18 @@
generator strategy. The strategy can be <literal>identity</literal>,
or any defined generator name of your application.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@TableGenerator(name="ids_generator", table="IDS")
public class Passport {
...
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name="PASSPORT_VISASTAMP")
- <emphasis role="bold">@CollectionId(
+ @CollectionId(
columns = @Column(name="COLLECTION_ID"),
type=@Type(type="long"),
generator = "ids_generator"
- )</emphasis>
+ )
private Collection<Stamp> visaStamp = new ArrayList();
...
}</programlisting>
@@ -3957,7 +3955,7 @@
only in very special cases (eg. audit logs, user session data,
etc).</para>
- <programlisting> @ManyToAny(
+ <programlisting role="JAVA" language="JAVA"> @ManyToAny(
metaColumn = @Column( name = "property_type" ) )
@AnyMetaDef(
idType = "integer",
@@ -4035,9 +4033,8 @@
<literal>PERSIST</literal> at flush time as per the
specification).</para>
- <programlisting>@OneToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE} <methodname
- role="bold">)
-(a)Cascade(org.hibernate.annotations.CascadeType.REPLICATE)</methodname>
+ <programlisting role="JAVA" language="JAVA">@OneToMany( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )
+(a)Cascade(org.hibernate.annotations.CascadeType.REPLICATE)
public Collection<Employer> getEmployers()</programlisting>
<para>It is recommended to use <classname>@Cascade</classname> to
@@ -4068,13 +4065,13 @@
entity load or the collection load. <literal>@Filter</literal> is used
and placed either on the entity or the collection element</para>
- <para><programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@FilterDef(name="minLength", parameters=@ParamDef( name="minLength", type="integer" ) )
@Filters( {
@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length"),
@Filter(name="minLength", condition=":minLength <= length")
} )
-public class Forest { ... }</programlisting></para>
+public class Forest { ... }</programlisting>
<para>When the collection use an association table as a relational
representation, you might want to apply the filter condition to the
@@ -4084,7 +4081,7 @@
association table, use the <literal>@FilterJoinTable</literal>
annotation.</para>
- <programlisting> @OneToMany
+ <programlisting role="JAVA" language="JAVA"> @OneToMany
@JoinTable
//filter on the target entity table
@Filter(name="betweenLength", condition=":minLength <= length and :maxLength >= length")
@@ -4162,13 +4159,13 @@
you can also override the SQL statement used to load or change the state
of entities.</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@Table(name="CHAOS")
-<emphasis role="bold">@SQLInsert( sql="INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper(?),?,?)")
+@SQLInsert( sql="INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper(?),?,?)")
@SQLUpdate( sql="UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? WHERE id = ?")
@SQLDelete( sql="DELETE CHAOS WHERE id = ?")
@SQLDeleteAll( sql="DELETE CHAOS")
-</emphasis><emphasis role="bold">@Loader(namedQuery = "chaos")</emphasis>
+@Loader(namedQuery = "chaos")
@NamedNativeQuery(name="chaos", query="select id, size, name, lower( nickname ) as nickname from CHAOS where id= ?", resultClass = Chaos.class)
public class Chaos {
@Id
@@ -4217,10 +4214,10 @@
<para>You can use the exact same set of annotations to override the
collection related statements.</para>
- <programlisting>@OneToMany
+ <programlisting role="JAVA" language="JAVA">@OneToMany
@JoinColumn(name="chaos_fk")
-<emphasis role="bold">@SQLInsert( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?")
-@SQLDelete( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?")</emphasis>
+@SQLInsert( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?")
+@SQLDelete( sql="UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?")
private Set<CasimirParticle> particles = new HashSet<CasimirParticle>();</programlisting>
<para>The parameters order is important and is defined by the order
@@ -4237,14 +4234,14 @@
all) attributes <literal>sqlInsert</literal>,
<literal>sqlUpdate</literal>, <literal>sqlDelete</literal>:</para>
- <programlisting>@Entity
+ <programlisting role="JAVA" language="JAVA">@Entity
@SecondaryTables({
@SecondaryTable(name = "`Cat nbr1`"),
@SecondaryTable(name = "Cat2"})
@org.hibernate.annotations.Tables( {
@Table(appliesTo = "Cat", comment = "My cat table" ),
@Table(appliesTo = "Cat2", foreignKey = @ForeignKey(name="FK_CAT2_CAT"), fetch = FetchMode.SELECT,
- <emphasis role="bold">sqlInsert=@SQLInsert(sql="insert into Cat2(storyPart2, id) values(upper(?), ?)") )</emphasis>
+ sqlInsert=@SQLInsert(sql="insert into Cat2(storyPart2, id) values(upper(?), ?)") )
} )
public class Cat implements Serializable {</programlisting>
@@ -4277,8 +4274,8 @@
<para>To define tuplixer in annotations, simply use the
<literal>@Tuplizer</literal> annotation on the according element</para>
- <programlisting>@Entity
-<emphasis role="bold">@Tuplizer(impl = DynamicEntityTuplizer.class)</emphasis>
+ <programlisting role="JAVA" language="JAVA">@Entity
+@Tuplizer(impl = DynamicEntityTuplizer.class)
public interface Cuisine {
@Id
@GeneratedValue
@@ -4288,7 +4285,7 @@
public String getName();
public void setName(String name);
- <emphasis role="bold">@Tuplizer(impl = DynamicComponentTuplizer.class)</emphasis>
+ @Tuplizer(impl = DynamicComponentTuplizer.class)
public Country getCountry();
public void setCountry(Country country);
}</programlisting>
@@ -4307,10 +4304,10 @@
fetch profile will be in affect for that session until it is explicitly
disabled. Lets look at an example:</para>
- <para><programlisting>@Entity
-<emphasis role="bold">@FetchProfile(name = "customer-with-orders", fetchOverrides = {
+ <programlisting role="JAVA" language="JAVA">@Entity
+@FetchProfile(name = "customer-with-orders", fetchOverrides = {
@FetchProfile.FetchOverride(entity = Customer.class, association = "orders", mode = FetchMode.JOIN)
-})</emphasis>
+})
public class Customer {
@Id
@GeneratedValue
@@ -4325,12 +4322,13 @@
// standard getter/setter
...
-}</programlisting>In the normal case the orders association would be lazy
+}</programlisting>
+ <para>In the normal case the orders association would be lazy
loaded by Hibernate, but in a usecase where it is more efficient to load
the customer and their orders together you could do something like
this:</para>
- <programlisting>Session session = ...;
+ <programlisting role="JAVA" language="JAVA">Session session = ...;
session.enableFetchProfile( "customer-with-orders" ); // name matches @FetchProfile name
Customer customer = (Customer) session.get( Customer.class, customerId );
session.disableFetchProfile( "customer-with-orders" ); // or just close the session
Modified: core/trunk/annotations/src/main/docbook/en/modules/setup.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-08 17:56:55 UTC (rev 18933)
+++ core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-08 18:24:20 UTC (rev 18934)
@@ -46,7 +46,7 @@
<para>Alternatively add the following dependency in your dependency
manager (like Maven or Ivy). Here is an example</para>
- <programlisting><project ...>
+ <programlisting role="XML" language="XML"><project ...>
...
<dependencies>
<dependency>
@@ -97,7 +97,8 @@
<filename>hibernate-validator.jar</filename> and
<filename>validation-api.jar</filename> in your classpath. Alternatively
add the following dependency in your
- <filename>pom.xml</filename>.<programlisting><project>
+ <filename>pom.xml</filename>.</para>
+ <programlisting role="XML" language="XML"><project>
...
<dependencies>
<dependency>
@@ -108,7 +109,7 @@
...
</dependencies>
...
-</project></programlisting></para>
+</project></programlisting>
<para>If you wish to use <ulink
url="http://search.hibernate.org">Hibernate Search</ulink>, download it
@@ -116,7 +117,7 @@
<filename>hibernate-search.jar</filename> and
<filename>lucene-core-x.y.z.jar</filename> in your classpath.
Alternatively add the following dependency in your
- <filename>pom.xml</filename>.<programlisting><project>
+ <filename>pom.xml</filename>.</para><programlisting role="XML" language="XML"><project>
...
<dependencies>
<dependency>
@@ -127,7 +128,7 @@
...
</dependencies>
...
-</project></programlisting></para>
+</project></programlisting>
<para>We recommend you use the JPA 2 APIs to bootstrap Hibernate (see the
Hibernate EntityManager documentation for more information). If you use
@@ -136,7 +137,8 @@
<para>If you boot Hibernate yourself, make sure to use the
<classname>AnnotationConfiguration</classname> class instead of the
<classname>Configuration</classname> class. Here is an example using the
- (legacy) <classname>HibernateUtil</classname> approach: <programlisting>package hello;
+ (legacy) <classname>HibernateUtil</classname> approach:</para>
+ <programlisting role="JAVA" language="JAVA">package hello;
import org.hibernate.*;
import org.hibernate.cfg.*;
@@ -146,12 +148,10 @@
public class HibernateUtil {
private static final SessionFactory sessionFactory;
-
static {
try {
-
sessionFactory = new <emphasis role="bold">AnnotationConfiguration()</emphasis>
- configure().buildSessionFactory();
+ .configure().buildSessionFactory();
} catch (Throwable ex) {
// Log exception!
throw new ExceptionInInitializerError(ex);
@@ -163,7 +163,7 @@
return sessionFactory.openSession();
}
}
- </programlisting></para>
+ </programlisting>
<para>Interesting here is the use of
<classname>AnnotationConfiguration</classname>. The packages and annotated
@@ -171,20 +171,20 @@
<filename>hibernate.cfg.xml</filename>). Here is the equivalent of the
above declaration:</para>
- <programlisting><!DOCTYPE hibernate-configuration PUBLIC
+ <programlisting role="XML" language="XML"><!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-
<hibernate-configuration>
<session-factory>
- <emphasis role="bold"><mapping package="test.animals"/>
+ <mapping package="test.animals"/>
<mapping class="test.Flight"/>
<mapping class="test.Sky"/>
<mapping class="test.Person"/>
- <mapping class="test.animals.Dog"/></emphasis>
-<emphasis role="bold"> <mapping resource="test/animals/orm.xml"/></emphasis>
+ <mapping class="test.animals.Dog"/>
+
+ <mapping resource="test/animals/orm.xml"/>
</session-factory>
-</hibernate-configuration> </programlisting>
+</hibernate-configuration></programlisting>
<para>Note that you can mix the legacy hbm.xml use and the annotation
approach. The resource element can be either an hbm file or an EJB3 XML
@@ -194,13 +194,13 @@
<para>Alternatively, you can define the annotated classes and packages
using the programmatic API</para>
- <programlisting>sessionFactory = new <emphasis role="bold">AnnotationConfiguration()
+ <programlisting role="JAVA" language="JAVA">sessionFactory = new <emphasis role="bold">AnnotationConfiguration()
.addPackage("test.animals") //the fully qualified package name
.addAnnotatedClass(Flight.class)
.addAnnotatedClass(Sky.class)
.addAnnotatedClass(Person.class)
- .addAnnotatedClass(Dog.class)</emphasis>
-<emphasis role="bold"> .addResource("test/animals/orm.xml")</emphasis>
+ .addAnnotatedClass(Dog.class)
+ .addResource("test/animals/orm.xml")</emphasis>
.configure()
.buildSessionFactory();</programlisting>
Modified: core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-08 17:56:55 UTC (rev 18933)
+++ core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-08 18:24:20 UTC (rev 18934)
@@ -53,7 +53,7 @@
<para>You can define global level metadata available for all XML files.
You must not define these metadata more than once per deployment.</para>
- <programlisting><?xml version="1.0" encoding="UTF-8"?>
+ <programlisting role="XML" language="XML"><?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
@@ -347,7 +347,7 @@
<literal>mapped-superclass/attributes</literal> or
<literal>embeddable/attributes</literal>.</para>
- <programlisting> <attributes>
+ <programlisting role="XML" language="XML"> <attributes>
<id name="id">
<column name="fld_id"/>
<generated-value generator="generator" strategy="SEQUENCE"/>
@@ -388,7 +388,7 @@
<literal>mapped-superclass/attributes</literal> or
<literal>embeddable/attributes</literal>.</para>
- <programlisting> <attributes>
+ <programlisting role="XML" language="XML"> <attributes>
<one-to-many name="players" fetch="EAGER">
<map-key name="name"/>
<join-column name="driver"/>
14 years, 9 months
Hibernate SVN: r18933 - core/trunk/annotations/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-03-08 12:56:55 -0500 (Mon, 08 Mar 2010)
New Revision: 18933
Modified:
core/trunk/annotations/src/main/docbook/en/modules/entity.xml
core/trunk/annotations/src/main/docbook/en/modules/setup.xml
core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
Log:
HHH-4933 removed all 'label' attributes in sections. they should not be used and they screw up the toc
Modified: core/trunk/annotations/src/main/docbook/en/modules/entity.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-08 16:40:44 UTC (rev 18932)
+++ core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-08 17:56:55 UTC (rev 18933)
@@ -26,7 +26,7 @@
<chapter id="entity">
<title>Mapping Entities</title>
- <section id="entity-overview" revision="2">
+ <section id="entity-overview">
<title>Intro</title>
<para>This section explains how to describe persistence mappings using
@@ -34,7 +34,7 @@
extensions.</para>
</section>
- <section id="entity-mapping" revision="2">
+ <section id="entity-mapping">
<title>Mapping with JPA (Java Persistence Annotations)</title>
<para>JPA entities are plain POJOs. Actually, they are Hibernate
@@ -136,7 +136,7 @@
you shouldn't worry about that.</remark>
</section>
- <section id="entity-mapping-entity-version" revision="1">
+ <section id="entity-mapping-entity-version">
<title>Versioning for optimistic locking</title>
<para>You can add optimistic locking capability to an entity using the
@@ -168,7 +168,7 @@
</section>
</section>
- <section id="entity-mapping-property" revision="1">
+ <section id="entity-mapping-property">
<title>Mapping simple properties</title>
<section>
@@ -377,7 +377,7 @@
</note>
</section>
- <section id="entity-mapping-property-column" revision="1">
+ <section id="entity-mapping-property-column">
<title>Declaring column attributes</title>
<para>The column(s) used for a property mapping can be defined using
@@ -646,8 +646,7 @@
</section>
</section>
- <section id="entity-mapping-identifier" label=""
- xreflabel="Mapping identifier properties">
+ <section id="entity-mapping-identifier">
<title>Mapping identifier properties</title>
<para>The <literal>@Id</literal> annotation lets you define which
@@ -1593,7 +1592,7 @@
} </programlisting>
</section>
- <section id="entity-mapping-association-collections" revision="1">
+ <section id="entity-mapping-association-collections">
<title>Collections</title>
<para>You can map <classname>Collection</classname>,
@@ -1606,8 +1605,7 @@
<classname>@ElementCollection</classname>. We will describe that in
more detail in the following subsections.</para>
- <section id="entity-mapping-association-collection-onetomany"
- revision="2">
+ <section id="entity-mapping-association-collection-onetomany">
<title>One-to-many</title>
<para>One-to-many associations are declared at the property level
@@ -1728,8 +1726,7 @@
(<literal>inversejoinColumns</literal>).</para>
</section>
- <section id="entity-mapping-association-collection-manytomany-default"
- revision="1">
+ <section id="entity-mapping-association-collection-manytomany-default">
<title>Defaults</title>
<para>Without describing any physical mapping, a unidirectional
@@ -1766,8 +1763,7 @@
</section>
</section>
- <section id="eentity-mapping-association-collection-manytomany"
- revision="">
+ <section id="eentity-mapping-association-collection-manytomany">
<title>Many-to-many</title>
<section>
@@ -1979,8 +1975,7 @@
</note>
</section>
- <section id="entity-mapping-association-collections-overview"
- revision="1">
+ <section id="entity-mapping-association-collections-overview">
<title>Indexed collections (List, Map)</title>
<para>Lists can be mapped in two different ways:</para>
@@ -2396,7 +2391,7 @@
customer.getOrders().remove(order); //order will be deleted by cascade</programlisting>
</section>
- <section id="entity-mapping-association-fetching" revision="1">
+ <section id="entity-mapping-association-fetching">
<title>Association fetching</title>
<para>You have the ability to either eagerly or lazily fetch
@@ -2704,8 +2699,7 @@
<para>Unfortunately, you lose the type-safety of queries written using the
Criteria API.</para>
- <section id="entity-mapping-query-hql" label="Mapping JPAQL/HQL queries"
- revision="1">
+ <section id="entity-mapping-query-hql">
<title>Mapping JP-QL/HQL queries</title>
<para>You can map JP-QL/HQL queries using annotations.
@@ -2823,7 +2817,7 @@
operations.</para>
</section>
- <section id="entity-mapping-query-native" revision="2">
+ <section id="entity-mapping-query-native">
<title>Mapping native queries</title>
<para>You can also map a native query (ie a plain SQL query). To achieve
@@ -3043,7 +3037,7 @@
</section>
</section>
- <section id="entity-hibspec" xreflabel="Hibernate Annotation Extensions">
+ <section id="entity-hibspec">
<title>Hibernate Annotation Extensions</title>
<para>Hibernate 3.1 offers a variety of additional annotations that you
@@ -3055,7 +3049,7 @@
<classname>org.hibernate.annotations</classname> package contains all
these annotations extensions.</para>
- <section id="entity-hibspec-entity" revision="4">
+ <section id="entity-hibspec-entity">
<title>Entity</title>
<para>You can fine tune some of the actions done by Hibernate on
@@ -3216,7 +3210,7 @@
public class Carrot extends Vegetable { ... }</programlisting></para>
</section>
- <section id="entity-hibspec-identifier" label="Identifier" revision="2">
+ <section id="entity-hibspec-identifier">
<title>Identifier</title>
<para>Hibernate Annotations goes beyond the Java Persistence
@@ -3313,7 +3307,7 @@
</section>
</section>
- <section id="entity-hibspec-property" revision="2">
+ <section id="entity-hibspec-property">
<title>Property</title>
<section>
@@ -3519,7 +3513,7 @@
</section>
</section>
- <section id="entity-hibspec-inheritance" revision="3">
+ <section id="entity-hibspec-inheritance">
<title>Inheritance</title>
<para>SINGLE_TABLE is a very powerful strategy but sometimes, and
@@ -3771,10 +3765,10 @@
</section>
</section>
- <section id="entity-hibspec-collection" revision="2">
+ <section id="entity-hibspec-collection">
<title>Collection related annotations</title>
- <section id="entity-hibspec-collection-enhance" revision="3">
+ <section id="entity-hibspec-collection-enhance">
<title>Enhance collection settings</title>
<para>It is possible to set <itemizedlist>
@@ -3857,11 +3851,10 @@
alter table Man_Woman add constraint TO_MAN_FK foreign key (man_id) references Man</programlisting>
</section>
- <section id="entity-hibspec-collection-extratype" revision="1">
+ <section id="entity-hibspec-collection-extratype">
<title>Extra collection types</title>
- <section id="entity-hibspec-collection-extratype-indexbidir"
- revision="2">
+ <section id="entity-hibspec-collection-extratype-indexbidir">
<title>Bidirectional association with indexed collections</title>
<para>A bidirectional association where one end is an indexed
@@ -3985,7 +3978,7 @@
</section>
</section>
- <section id="entity-hibspec-cascade" xreflabel="Cascade">
+ <section id="entity-hibspec-cascade">
<title>Cascade</title>
<para>Hibernate offers more operations than the Java Persistence
@@ -4161,7 +4154,7 @@
ability to set those annotations at a package level.</para>
</section>
- <section id="entity-hibspec-customsql" revision="1">
+ <section id="entity-hibspec-customsql">
<title>Custom SQL for CRUD operations</title>
<para>Hibernate gives you the ability to override every single SQL
Modified: core/trunk/annotations/src/main/docbook/en/modules/setup.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-08 16:40:44 UTC (rev 18932)
+++ core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2010-03-08 17:56:55 UTC (rev 18933)
@@ -25,9 +25,9 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter>
- <title id="setup" revision="1">Setting up an annotations project</title>
+ <title id="setup">Setting up an annotations project</title>
- <section id="setup-requirements" revision="2">
+ <section id="setup-requirements">
<title>Requirements</title>
<itemizedlist>
@@ -60,7 +60,7 @@
</itemizedlist>
</section>
- <section id="setup-configuration" revision="2">
+ <section id="setup-configuration">
<title>Configuration</title>
<para>First, set up your classpath (after you have created a new project
Modified: core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-08 16:40:44 UTC (rev 18932)
+++ core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2010-03-08 17:56:55 UTC (rev 18933)
@@ -24,7 +24,7 @@
-->
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="xml-overriding" label="Overriding metadata through XML">
+<chapter id="xml-overriding">
<title>Overriding metadata through XML</title>
<para>The primary target for metadata in EJB3 is annotations, but the EJB3
@@ -83,7 +83,7 @@
feature.</para>
</section>
- <section id="xml-overriding-principles-entity" revision="1">
+ <section id="xml-overriding-principles-entity">
<title>Entity level metadata</title>
<para>You can either define or override metadata informations on a given
@@ -424,4 +424,4 @@
informations in the chapter describing annotations.</para>
</section>
</section>
-</chapter>
\ No newline at end of file
+</chapter>
14 years, 9 months
Hibernate SVN: r18932 - core/trunk/annotations/src/main/docbook/en/modules.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-03-08 11:40:44 -0500 (Mon, 08 Mar 2010)
New Revision: 18932
Modified:
core/trunk/annotations/src/main/docbook/en/modules/entity.xml
Log:
HHH-4933 fixed some minor typos
Modified: core/trunk/annotations/src/main/docbook/en/modules/entity.xml
===================================================================
--- core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-05 22:22:05 UTC (rev 18931)
+++ core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2010-03-08 16:40:44 UTC (rev 18932)
@@ -617,34 +617,32 @@
<title>Non-annotated property defaults</title>
<para>If a property is not annotated, the following rules
- apply:</para>
+ apply:<itemizedlist>
+ <listitem>
+ <para>If the property is of a single type, it is mapped as
+ @Basic</para>
+ </listitem>
- <itemizedlist>
- <listitem>
- <para>If the property is of a single type, it is mapped as
- @Basic</para>
- </listitem>
+ <listitem>
+ <para>Otherwise, if the type of the property is annotated as
+ @Embeddable, it is mapped as @Embedded</para>
+ </listitem>
- <listitem>
- <para>Otherwise, if the type of the property is annotated as
- @Embeddable, it is mapped as @Embedded</para>
- </listitem>
+ <listitem>
+ <para>Otherwise, if the type of the property is
+ <classname>Serializable</classname>, it is mapped as
+ <classname>@Basic</classname> in a column holding the object in
+ its serialized version</para>
+ </listitem>
- <listitem>
- <para>Otherwise, if the type of the property is
- <classname>Serializable</classname>, it is mapped as
- <classname>@Basic</classname> in a column holding the object in
- its serialized version</para>
- </listitem>
-
- <listitem>
- <para>Otherwise, if the type of the property is
- <classname>java.sql.Clob</classname> or
- <classname>java.sql.Blob</classname>, it is mapped as
- <classname>@Lob</classname> with the appropriate
- <classname>LobType</classname></para>
- </listitem>
- </itemizedlist>
+ <listitem>
+ <para>Otherwise, if the type of the property is
+ <classname>java.sql.Clob</classname> or
+ <classname>java.sql.Blob</classname>, it is mapped as
+ <classname>@Lob</classname> with the appropriate
+ <classname>LobType</classname></para>
+ </listitem>
+ </itemizedlist></para>
</section>
</section>
@@ -746,7 +744,7 @@
</programlisting>
<para>If JPA XML (like <filename>META-INF/orm.xml</filename>) is used
- to define thegenerators, <literal>EMP_GEN</literal> and
+ to define the generators, <literal>EMP_GEN</literal> and
<literal>SEQ_GEN</literal> are application level generators.
<literal>EMP_GEN</literal> defines a table based id generator using
the hilo algorithm with a <literal>max_lo</literal> of 20. The hi
@@ -1005,7 +1003,7 @@
<section>
<title>Multiple @Id properties</title>
- <para>Another arguably more natural) approach is to place
+ <para>Another, arguably more natural, approach is to place
<classname>@Id</classname> on multiple properties of my entity. This
approach is only supported by Hibernate but does not require an
extra embeddable component.</para>
14 years, 9 months