Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipse link connectivity with mysql
Eclipse link connectivity with mysql [message #1801888] Tue, 29 January 2019 08:41
Prakhar Verma is currently offline Prakhar VermaFriend
Messages: 1
Registered: January 2019
Junior Member
Hi Team,


I am facing a issue with the EclipseLink DDL Creation with mysql.
Example ->
I have a lot of entities. Like Employee,Role and all.

package com.altametrics.lms.core;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;

import com.altametrics.foundation.FNArrayList;
import com.altametrics.foundation.FNHashMap;
import com.altametrics.foundation.FNPanelException;
import com.altametrics.foundation.ajax.FNActionType;
import com.altametrics.foundation.ajax.FNAjax;
import com.altametrics.foundation.factories.setup.FNClassSerial;
import com.altametrics.foundation.factories.setup.FNSerial;
import com.altametrics.foundation.security.factories.FNReqRespThreadFactory;
import com.altametrics.persistence.model.MDCol;
import com.altametrics.persistence.object.EOObject;
import com.altametrics.ui.UIType;

//LK_Department
@Entity

@SequenceGenerator(name = "EODEPARTMENT_SEQ", allocationSize = 50, sequenceName = "EODEPARTMENT_SEQ")
@NamedQueries(value = { @NamedQuery(name = "EODepartment.findByDesc", query = "SELECT e FROM EODepartment e WHERE LOWER(e.description)=:description") })
public class EODepartment extends EOObject {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EODEPARTMENT_SEQ")
private Long primaryKey;


public String description;

public long displayOrder;

public boolean isActive = true;

@OneToMany(mappedBy = "eoDepartment")
public Set<EOMarkingParam> eoMarkingParamArray = new LinkedHashSet<>();

@OneToMany(mappedBy = "eoDepartment")
public Set<EOEmpMain> eoEmployeeArray = new LinkedHashSet<>();

@OneToMany(mappedBy = "eoDepartment")
public Set<EOSchMain> eoSchMainArray = new LinkedHashSet<>();

@Override
public Long primaryKey() {
return this.primaryKey;
}


}


@Entity
@SequenceGenerator(name = "EOUSERMARKING_SEQ", allocationSize = 50, sequenceName = "EOUSERMARKING_SEQ")
public class EOUserMarking extends EOObject {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EOUSERMARKING_SEQ")
private Long primaryKey;
public int marksObtained;
public int totalMarks;

@ManyToOne
@JoinColumn(name = "EOMarkingParamID")
public EOMarkingParam eoMarkingParam;

@ManyToOne
@JoinColumn(name = "EOUserTestID")
public EOUserTest eoUserTest;

@Override
public Long primaryKey() {
return this.primaryKey;
}

}
And this is the persistence.xml config

____________________________________________________________________________________________
<properties>

<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/TAD" />
<property name="javax.persistence.jdbc.user" value="belrium" />
<property name="javax.persistence.jdbc.password" value="B3lrium" />
<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
<property name="javax.persistence.target-database" value="MySQL"/>
<property name="javax.persistence.logging.level" value="INFO"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="eclipselink.target-database" value="MySQL"/>
<property name="eclipselink.jdbc.bind-parameters" value="true"/>
<property name="eclipselink.jdbc.cache-statements" value="true"/>
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.create-ddl-jdbc-file-name" value="HW-createDDL.sql" />
<property name="eclipselink.ddl-generation" value="create-or-extend-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.drop-ddl-jdbc-file-name" value="HW-dropDDL.sql" />
</properties>

______________________________________________________________________________________________

Issue is that when table creation query fires for first time its execute in the capital letter complitely.
Query is ->

[EL Fine]: sql: 2019-01-29 14:02:24.025--ServerSession(1048937392)--Connection(1933345265)--CREATE TABLE EOUSERMARKING (PRIMARYKEY BIGINT AUTO_INCREMENT NOT NULL, MARKSOBTAINED INTEGER, SRCPRIMARYKEY BIGINT, TOTALMARKS INTEGER, EOMarkingParamID BIGINT, EOUserTestID BIGINT, PRIMARY KEY (PRIMARYKEY))

[EL Fine]: sql: 2019-01-29 14:02:39.705--ServerSession(1048937392)--Connection(2036957781)--CREATE TABLE EODEPARTMENT (PRIMARYKEY BIGINT AUTO_INCREMENT NOT NULL, DESCRIPTION VARCHAR(255), DISPLAYORDER BIGINT, ISACTIVE TINYINT(1) default 0, SRCPRIMARYKEY BIGINT, PRIMARY KEY (PRIMARYKEY))

Connection(1796792000)--CREATE TABLE EOSETUPPPTDETAIL (PRIMARYKEY BIGINT AUTO_INCREMENT NOT NULL, JSONDATA LONGTEXT, PPTSETUPID VARCHAR(255), SRCPRIMARYKEY BIGINT, EOHeaderID BIGINT NOT NULL, PRIMARY KEY (PRIMARYKEY))

-CREATE TABLE EOCANDIDATE (PRIMARYKEY BIGINT AUTO_INCREMENT NOT NULL, CONTACTNUMBER BIGINT, CREATEDON DATE, DOB DATE, EMAILID VARCHAR(255), ISHIRED TINYINT(1) default 0, LASTTESTON DATE, NAME VARCHAR(255), PASSWORDHASH VARCHAR(255), SRCPRIMARYKEY BIGINT, EOEmpMainID BIGINT, PRIMARY KEY (PRIMARYKEY))



MySQL table description is..

mysql> desc EODEPARTMENT;
+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| PRIMARYKEY | bigint(20) | NO | PRI | NULL | auto_increment |
| DESCRIPTION | varchar(255) | YES | | NULL | |
| DISPLAYORDER | bigint(20) | YES | | NULL | |
| ISACTIVE | tinyint(1) | YES | | 0 | |
| SRCPRIMARYKEY | bigint(20) | YES | | NULL | |
+---------------+--------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

mysql> desc EOUSERMARKING;
+------------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+------------+------+-----+---------+----------------+
| PRIMARYKEY | bigint(20) | NO | PRI | NULL | auto_increment |
| MARKSOBTAINED | int(11) | YES | | NULL | |
| SRCPRIMARYKEY | bigint(20) | YES | | NULL | |
| TOTALMARKS | int(11) | YES | | NULL | |
| EOMarkingParamID | bigint(20) | YES | | NULL | |
| EOUserTestID | bigint(20) | YES | | NULL | |
+------------------+------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> desc EOCANDIDATE;
+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| PRIMARYKEY | bigint(20) | NO | PRI | NULL | auto_increment |
| CONTACTNUMBER | bigint(20) | YES | | NULL | |
| CREATEDON | date | YES | | NULL | |
| DOB | date | YES | | NULL | |
| EMAILID | varchar(255) | YES | UNI | NULL | |
| ISHIRED | tinyint(1) | YES | | 0 | |
| LASTTESTON | date | YES | | NULL | |
| NAME | varchar(255) | YES | | NULL | |
| PASSWORDHASH | varchar(255) | YES | | NULL | |
| SRCPRIMARYKEY | bigint(20) | YES | | NULL | |
| EOEmpMainID | bigint(20) | YES | | NULL | |
+---------------+--------------+------+-----+---------+----------------+
11 rows in set (0.00 sec)



Issue fields should be in the camel case..
but its convert fields into capital letter


Previous Topic:Mapping to single inheritance strategy fails "Conversion failed when converting the nvarchar va
Next Topic:CommitManager.sort not working if primary key is a byte array
Goto Forum:
  


Current Time: Wed Oct 23 18:54:27 GMT 2019

Powered by FUDForum. Page generated in 0.02294 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top