加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 错误:导入com.google.appengine.api.datastore无法解析

发布时间:2020-12-14 19:36:14 所属栏目:Java 来源:网络整理
导读:开发模式出错 [ERROR] [cbd] - Line 15: The import com.google.appengine.api.datastore cannot be resolved User.java @Entitypublic class User implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="id") @Ge
开发模式出错
[ERROR] [cbd] - Line 15: The import com.google.appengine.api.datastore cannot be resolved

User.java

@Entity
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name="id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;

    private String googleID;

    private String firstName;

    private String lastName;

    private String password;

    private String gender;

    private String email;


    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="key")
    private AuthenticationToken token= AuthenticationToken();
    ......}

AuthenticationToken.java

public class AuthenticationToken implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name="key")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key key;

    private String email;

    private String token;

    private Date obtained;

    private Date activity;
    .....}

persistence.xml中

<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">

    <persistence-unit name="transactions-optional">


        <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>

        <class>com.cbd.shared.entities.User</class>

    <class>com.cbd.shared.entities.AuthenticationToken</class>

    <exclude-unlisted-classes>true</exclude-unlisted-classes>

        <properties>
            <property name="datanucleus.NontransactionalRead" value="true"/>
            <property name="datanucleus.NontransactionalWrite" value="true"/>
            <property name="datanucleus.ConnectionURL" value="appengine"/>
        </properties>
    </persistence-unit>
</persistence>

我正在使用GWT尝试将实体移动到服务器端而不是共享端包但是同样的错误

解决方法

发现错误.没有将DataNucleus插件添加到eclipse中,因此在Project Runtime中没有明确定义一些JPA库

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读