使用JPQL获取数据库的日期

时间:2014-10-31 20:47:48

标签: jpa ejb entity

我有下一个代码:

package co.com.patios.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
public class Date {

    private java.util.Date dateActual;

    @Id
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    public java.util.Date getDateActual() {
        return dateActual;
    }

    public void setDateActual(java.util.Date dateActual) {
        this.dateActual = dateActual;
    }
}


<?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="PatiosDS">
    <jta-data-source>java:jboss/datasources/PatiosDS</jta-data-source>
    <class>co.com.patios.entity.Date</class>
    <class>co.com.patios.entity.EntradaVehiculoPatio</class>
    <class>co.com.patios.entity.EstadoVehiculo</class>
    <class>co.com.patios.entity.MarcaVehiculo</class>
    <class>co.com.patios.entity.ModeloVehiculo</class>
    <class>co.com.patios.entity.Patio</class>
    <class>co.com.patios.entity.Usuario</class>
    <class>co.com.patios.entity.Vehiculo</class>
    <properties>
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.default_schema" value="public" />
        <property name="hibernate.transaction.jta.platform" 
                  value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
    </properties>
</persistence-unit>

我的问题是注释@Entity,显示下一条消息

  

表“日期”无法解决

我的文件persistence.xml中有下一行“co.com.patios.entity.Date”

我想知道,可能是什么问题?

注意:代码运行正确,但显示消息

  

表“日期”无法解决

它在eclipse中显示错误

0 个答案:

没有答案