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

Hibernate example source code file (VanillaSwap.java)

This example Hibernate source code file (VanillaSwap.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

attributeoverride, attributeoverride, column, currency, currency, embedded, eur, fixedleg, float_frequency, floatleg, floatleg, id, string, string

The Hibernate VanillaSwap.java source code

package org.hibernate.test.annotations.embedded;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * Represents an Interest Rate Swap.
 */
@Entity
public class VanillaSwap {

	/**
	 * Possible values for the currency field.
	 */
	public enum Currency {
		USD, GBP, EUR, JPY }

	/**
	 * Identifier of the Interest Rate Swap
	 */
	private String instrumentId;

	/**
	 * Currency of the swap (and of both legs).
	 */
	private Currency currency;

	/**
	 * Fixed leg (cash flows with the fixed rate).
	 */
	private FixedLeg fixedLeg;

	/**
	 * Floating leg (cash flows bound to a financial index).
	 */
	private FloatLeg floatLeg;

	@Embedded
	@AttributeOverride(name = "paymentFrequency", column = @Column(name = "FIXED_FREQENCY"))
	public FixedLeg getFixedLeg() {
		return fixedLeg;
	}

	public void setFixedLeg(FixedLeg fixedLeg) {
		this.fixedLeg = fixedLeg;
	}

	@Embedded
	@AttributeOverride(name = "paymentFrequency", column = @Column(name = "FLOAT_FREQUENCY"))
	public FloatLeg getFloatLeg() {
		return floatLeg;
	}

	public void setFloatLeg(FloatLeg floatLeg) {
		this.floatLeg = floatLeg;
	}

	public Currency getCurrency() {
		return currency;
	}

	public void setCurrency(Currency currency) {
		this.currency = currency;
	}

	@Id
	public String getInstrumentId() {
		return instrumentId;
	}

	public void setInstrumentId(String instrumentId) {
		this.instrumentId = instrumentId;
	}
}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate VanillaSwap.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.