Error mapping entities from the database

1

I am developing an application in Windows 7 with NetBeans 8.1 and a SQL Server 2012 database. I have mapped the entities directly from the database but at the moment of starting my application I get this error:

  

Severe: Exception while preparing the app: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b):

     

org.eclipse.persistence.exceptions.EntityManagerSetupException

     

Exception Description: Predeployment of PersistenceUnit [SEFARCOL_PU] failed.

     

Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b):

     

org.eclipse.persistence.exceptions.ValidationException

     

Exception Description: [class com.mycompany.sefarcoldatos.Lineaproduccion] uses a non-entity [class com.mycompany.sefarcoldatos.Tipolinea] as a target entity in the relationship attribute [field idtipolinea].

Does anyone know why this exception happens, and what can I do to correct it?

    
asked by Alexander Gil Tafur 11.04.2016 в 17:56
source

3 answers

0
  

Exception Description: [class com.mycompany.sefarcoldatos.Lineaproduccion] uses a non-entity [class com.mycompany.sefarcoldatos.Tipolinea] as a target entity in the relationship attribute [field idtipolinea].

Mapping was not performed correctly between the Lineaproduccion and Tipolinea entities in the idtipolinea field.

Tipolinea is not an entity or is not inside the file persistence.xml .

    
answered by 04.11.2016 в 20:50
0

In the logo I can see two errors the first one is:

  • This exception occurs when you have not added your table to persistence.xml you can do it this way, it is usually found in src\main\resources\META-INF\persistence.xml

    <class>nombre de tu paquete y clase</class>
    
  • Finally some times when we have columns type Date() and for that you have to add this annotation where you mapped them

    @Temporal(javax.persistence.TemporalType.DATE)
    
answered by 16.02.2018 в 15:11
0

It seems to me that you are using an incorrect library for the connection, that is why you do not understand the relations, or in your database you are not using the fields that your library understands, that is, if you use the 4.0 library for backwards and forwards. you use data types BIGINT, IMAGE, MONEY, VARBINARY ... etc
You must use current libraries. In my case I use the 7.0, with the search name: mssql-jdbc-7.0.0.jre8
you can search in the microsoft pages or in this link. Mega Microsoft SQL Server 7.0 driver

    
answered by 22.10.2018 в 22:06