JPA 샘플 클래스 MyEntity

1 개요[ | ]

JPA 샘플 클래스 MyEntity
package com.example.myapp;

import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Currency;
import java.util.Locale;
import java.util.TimeZone;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class MyEntity {
	@Id private Long id;
	
	@Column private Integer myInteger;
	@Column private Long myLong;
	@Column private Short myShort;
	@Column private Float myFloat;
	@Column private Double myDouble;
	@Column private String myString;
	@Column private Byte myByte;
	@Column private Byte[] myBytes;
	@Column private Boolean myBoolean;
	@SuppressWarnings("rawtypes")
	@Column private Class myClass;

	// java.sql
	@Column private Timestamp myTimestamp;
	@Column private Date myDate;
	@Column private Time myTime;

	// java.math
	@Column private BigDecimal myBigDecimal;
	
	// java.io
	@Column private Serializable mySerializable;
	
	// java.sql
	@Column private Clob myClob;
	@Column private Blob myBlob;

	// java.util
	@Column private Calendar myCalendar;
	@Column private Locale myLocale;
	@Column private TimeZone myTimeZone;
	@Column private Currency myCurrency;
}

2 결과 테이블 my_entity[ | ]

# DB컬럼명 DB자료형 원래 Java자료형
1 id bigint(20) Long
2 my_big_decimal decimal(19,2) BigDecimal
3 my_blob longblob Blob
4 my_boolean bit(1) Boolean
5 my_byte tinyint(4) Byte
6 my_bytes tinyblob Byte[]
7 my_calendar datetime Calendar
8 my_class varchar(255) Class
9 my_clob longtext Clob
10 my_currency varchar(255) Currency
11 my_date date Date
12 my_double double Double
13 my_float float Float
14 my_integer int(11) Integer
15 my_locale varchar(255) Locale
16 my_long bigint(20) Long
17 my_serializable tinyblob Serializable
18 my_short smallint(6) Short
19 my_string varchar(255) String
20 my_time time Time
21 my_time_zone varchar(255) TimeZone
22 my_timestamp datetime Timestamp

3 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}