何时以及如何创建JDBC表? 因为奇怪的是我找不到任何用户标签。 我觉得很奇怪,User和Dish之间存在多对多关系,但是没有User tabel来存储该用户的名称和密码。
String name
String password
List<Dish> shoppingList
String name
Ingredient ingredient
Quantity quantity
int quantity
String unit
String name
int people
Collection<IngredientQuantity> ingredients
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="ShoppingCalendarPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>domain.Dish</class>
<class>domain.Ingredient</class>
<class>domain.User</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/ShoppingCalendarDB"/>
<property name="javax.persistence.jdbc.password" value="app"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/>
<property name="javax.persistence.jdbc.user" value="app"/>
<property name="javax.persistence.schema-generation.database.action" value="create"/>
</properties>
</persistence-unit>
</persistence>
答案 0 :(得分:0)
如 JB Nizet 所述,表名“user”已保留。