alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (AuditMappedBy.java)

This example Hibernate source code file (AuditMappedBy.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

annotation, auditmappedby, auditmappedby, string, string, target, target

The Hibernate AuditMappedBy.java source code

package org.hibernate.envers;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * <p>
 * Annotation to specify a "fake" bi-directional relation. Such a relation uses {@code @OneToMany} +
 * {@code @JoinColumn} on the one side, and {@code @ManyToOne} + {@code @Column(insertable=false, updatable=false)} on
 * the many side. Then, Envers won't use a join table to audit this relation, but will store changes as in a normal
 * bi-directional relation.
 * </p>
 *
 * <p>
 * This annotation is <b>experimental and may change in future releases.
 * </p>
 *
 * @author Adam Warski (adam at warski dot org)
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.FIELD})
public @interface AuditMappedBy {
    /**
     * @return Name of the property in the related entity which maps back to this entity. The property should be
     * mapped with {@code @ManyToOne} and {@code @Column(insertable=false, updatable=false)}.
     */
    String  mappedBy();

    /**
     * @return Name of the property in the related entity which maps to the position column. Should be specified only
     * for indexed collection, when @{@link org.hibernate.annotations.IndexColumn} is used on the collection.
     * The property should be mapped with {@code @Column(insertable=false, updatable=false)}.
     */
    String  positionMappedBy()  default "";
}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate AuditMappedBy.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.