@Access
Last updated
Was this helpful?
Last updated
Was this helpful?
Used to specify an access type to be applied to an entity class, mapped superclass, or embeddable class, or to a specific attribute of such a class.
ํน์ access type์ ์ค์ ํ๋ ๊ฒ.
ํ์ ์๋ 2๊ฐ์ง ์์. (AccessType)
FIELD
PROPERTY
์ ์ค์ ํ์ง?
JPA๊ฐ ์ด๋ป๊ฒ ์ํฐํฐ์ properties์ ์ ๊ทผํ๋ ์ง ์๋ ค์ฃผ๋ ๊ฒ.
FIELD ๋ฐฉ์์ด๋ฉด, ํด๋น ํ๋๋ก ์ง์ ์ ๊ทผ (getter, setter๋ฅผ ํตํ์ง ์์.)
PROPERTY ๋ฐฉ์์ด๋ฉด, getter, setter์ ํตํด field์ ์ ๊ทผ.
์ฆ ์ ๊ทผ ์์ ๋ญ๊ฐ ์ฒ๋ฆฌ ์ฝ๋๊ฐ ํ์ํ๋ฉด PROPERTY ๋ฐฉ์์ ์ฌ์ฉํ์ง ์์๊น ์๊ฐ๋ฌ.
default?
@id
๊ฐ field์ ์์ผ๋ฉด FILED ๋ฐฉ์ ์ฌ์ฉ.
getter ์ ์์ผ๋ฉด PROPERTY ๋ฐฉ์ ์ฌ์ฉ.