创建EntityManagerFactory时出错 - 创建实体时出现错误异常

时间:2015-11-28 13:15:36

标签: java eclipselink jpa-2.1

我在编译实体时遇到错误...我认为错误是在persistence.xml文件中但无法找出问题。可以任何一个请告诉错误

persistence.xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Team A"
    android:textSize="16sp"
    android:gravity="center_horizontal"
    android:padding="4dp"/>

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="0"
    android:id="@+id/team_a_score"
    android:textSize="16sp"
    android:gravity="center_horizontal"
    android:padding="4dp"/>
<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="+3 Points"
    android:layout_margin="8dp"/>
<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="+2 Points"
    android:layout_margin="8dp"/>
<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Free Throw"
    android:layout_margin="8dp"/>
 </LinearLayout>

Eclipse错误

<?xml version="1.0" encoding="UTF-8"?>
<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="AP">
    <class>db.User</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value ="com.mysql.jdbc.Driver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/khan"/>
            <property name="javax.persistence.jdbc.user" value="root"/>
            <property name="javax.persistence.jdbc.password" value="password"/>
            <property name="eclipse.link.ddl-generation" value="create-or-extend tables"/>
            <property name="eclipse.link.create-ddl-jdbc-file-name" value="createDDL_ddlgeneration.jdbc"/>
            <property name="eclipse.link.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc"/>
            <property name="eclipse.link.ddl-generation.output-mode" value="both"/>
        </properties>

</persistence-unit>

0 个答案:

没有答案