001/*
002 * Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved.
003 *
004 * This program and the accompanying materials are made available under the
005 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
006 * which accompanies this distribution.  The Eclipse Public License is available
007 * at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License
008 * is available at http://www.eclipse.org/org/documents/edl-v10.php.
009 */
010package javax.persistence;
011
012import java.lang.annotation.Retention;
013import java.lang.annotation.Target;
014
015import static java.lang.annotation.ElementType.FIELD;
016import static java.lang.annotation.ElementType.METHOD;
017import static java.lang.annotation.RetentionPolicy.RUNTIME;
018
019/**
020 * Specifies that a persistent property or field should be persisted
021 * as a large object to a database-supported large object type.
022 * <p>
023 * <p> Portable applications should use the <code>Lob</code> annotation
024 * when mapping to a database Lob type.  The <code>Lob</code>
025 * annotation may be used in conjunction with the {@link Basic}
026 * annotation or the {@link ElementCollection} annotation when the
027 * element collection value is of basic type. A <code>Lob</code> may
028 * be either a binary or character type.
029 * <p>
030 * <p> The <code>Lob</code> type is inferred from the type of the
031 * persistent field or property, and except for string and
032 * character-based types defaults to Blob.
033 * <pre>
034 *
035 *   Example 1:
036 *
037 *   &#064;Lob &#064;Basic(fetch=LAZY)
038 *   &#064;Column(name="REPORT")
039 *   protected String report;
040 *
041 *   Example 2:
042 *
043 *   &#064;Lob &#064;Basic(fetch=LAZY)
044 *   &#064;Column(name="EMP_PIC", columnDefinition="BLOB NOT NULL")
045 *   protected byte[] pic;
046 *
047 * </pre>
048 *
049 * @see Basic
050 * @see ElementCollection
051 * @since Java Persistence 1.0
052 */
053@Target({METHOD, FIELD})
054@Retention(RUNTIME)
055public @interface Lob {
056}