"JPA 샘플 클래스 MyEntity"의 두 판 사이의 차이

63번째 줄: 63번째 줄:
==결과 테이블==
==결과 테이블==
{| class='wikitable'
{| class='wikitable'
! Column !! Type
! # !! Column !! Type
|-
|-
| id (Primary) || bigint(20)
| 1 || id (Primary) || bigint(20)
|-
|-
| my_big_decimal || decimal(19,2)
| 2 || my_big_decimal || decimal(19,2)
|-
|-
| my_blob || longblob
| 3 || my_blob || longblob
|-
|-
| my_boolean || bit(1)
| 4 || my_boolean || bit(1)
|-
|-
| my_byte || tinyint(4)
| 5 || my_byte || tinyint(4)
|-
|-
| my_bytes || tinyblob
| 6 || my_bytes || tinyblob
|-
|-
| my_calendar || datetime
| 7 || my_calendar || datetime
|-
|-
| my_class || varchar(255)
| 8 || my_class || varchar(255)
|-
|-
| my_clob || longtext
| 9 || my_clob || longtext
|-
|-
| my_currency || varchar(255)
| 10 || my_currency || varchar(255)
|-
|-
| my_date || date
| 11 || my_date || date
|-
|-
| my_double || double
| 12 || my_double || double
|-
|-
| my_float || float
| 13 || my_float || float
|-
|-
| my_integer || int(11)
| 14 || my_integer || int(11)
|-
|-
| my_locale || varchar(255)
| 15 || my_locale || varchar(255)
|-
|-
| my_long || bigint(20)
| 16 || my_long || bigint(20)
|-
|-
| my_serializable || tinyblob
| 17 || my_serializable || tinyblob
|-
|-
| my_short || smallint(6)
| 18 || my_short || smallint(6)
|-
|-
| my_string || varchar(255)
| 19 || my_string || varchar(255)
|-
|-
| my_time || time
| 20 || my_time || time
|-
|-
| my_time_zone || varchar(255)
| 21 || my_time_zone || varchar(255)
|-
|-
| my_timestamp || datetime
| 22 || my_timestamp || datetime
|}
|}



2016년 7월 13일 (수) 15:42 판

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 결과 테이블

# Column Type
1 id (Primary) bigint(20)
2 my_big_decimal decimal(19,2)
3 my_blob longblob
4 my_boolean bit(1)
5 my_byte tinyint(4)
6 my_bytes tinyblob
7 my_calendar datetime
8 my_class varchar(255)
9 my_clob longtext
10 my_currency varchar(255)
11 my_date date
12 my_double double
13 my_float float
14 my_integer int(11)
15 my_locale varchar(255)
16 my_long bigint(20)
17 my_serializable tinyblob
18 my_short smallint(6)
19 my_string varchar(255)
20 my_time time
21 my_time_zone varchar(255)
22 my_timestamp datetime

3 같이 보기

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