English 中文(简体)
为什么我们需要用@Entity通知一个POJO。
原标题:Why do we need to annotate a POJO with @Entity

我从日本宇宙航行局开始,我对为什么我们需要用<代码>@Entity来说明这一类。 我认为这样做的唯一原因,是,如果想要在数据库中提供一个相应的表格,则自动生成工具可以发现它是一个实体。

public class Book {
    //Fields
}

页: 1

@Entity
public class Book {
    //Fields
}

我知道第一部法典——如果我试图与实体manager一样坚持下去,就会成为一种例外。

问题回答

初专干事方案的实施需要了解哪些班级必须坚持/稳定(根据《初专干事计划》的设想)。 但是,你不必说什么东西......你可以用 or子确定什么是可以坚持的。

From the Java Persistence API FAQ:

Java Persistence 预报器是POJO在物体/关系制图方面的持久性反应器。 报告载有支持使用 Java语元数据说明和(或)XML描述器确定 Java物体和关系数据库之间制图的全标/相对制图规格。

有了@Entity,通知都涉及在Pojo增加元数据(配置)。 另一种做法是让它采用某种接口和/或Xml配置。 但是,说明在实际守则中更为贴近,可以由 Java汇编者核对。

http://www.oracle.com/technetwork/articles/javaee/jpa-137156.html The Java Persistence AP - A briefr Program Model for entities Persistence

我认为,约翰正在问这个问题,因为我们正在把“意向”(`Id'等)之外的其他含义通知日本统计局。 如果该类别是附加说明的《政府采购协议》实施情况,然后进入该类别,以获取其余地图,而不是通过一个项目中的所有类别,试图对不存在的元数据进行扫描。

This is just my idea, I may or may not be correct so... :-D





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签