Salesforce Compilation errors on generating apex class from WSDL - salesforce

When I am trying to generate Apex classes from the below WSDL file I am getting the
The following generated class(es) have compilation errors:
Error: testxyzCom
Error: unexpected token: 'limit' at 7:23
The generated class is also given below. I already have some experience in Salesforce and as far as I remember if a WSDL document contains an Apex reserved word, the word is appended with _x when the Apex class is generated. For example, limit in a WSDL document converts to limit_x in the generated Apex class. But this is not happening in above case please explain. Please help me out.
The WSDL file
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://test.xyz.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://test.xyz.com" xmlns:intf="http://test.xyz.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://test.xyz.com" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="createOpurtunityData">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="keys" type="xsd:string"/>
<element maxOccurs="unbounded" name="values" type="xsd:string"/>
<element name="limit" type="xsd:int"/>
</sequence>
</complexType>
</element>
<element name="createOpurtunityDataResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="createOpurtunityDataReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="createOpurtunityDataResponse">
<wsdl:part element="impl:createOpurtunityDataResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="createOpurtunityDataRequest">
<wsdl:part element="impl:createOpurtunityData" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="TestWSDL">
<wsdl:operation name="createOpurtunityData">
<wsdl:input message="impl:createOpurtunityDataRequest" name="createOpurtunityDataRequest">
</wsdl:input>
<wsdl:output message="impl:createOpurtunityDataResponse" name="createOpurtunityDataResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestWSDLSoapBinding" type="impl:TestWSDL">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createOpurtunityData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="createOpurtunityDataRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="createOpurtunityDataResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestWSDLService">
<wsdl:port binding="impl:TestWSDLSoapBinding" name="TestWSDL">
<wsdlsoap:address location="http://tempuri.org/Salesforcexyz/services/TestWSDL"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Generated Apex class is
/Generated by wsdl2apex
public class testxyzCom {
public class createOpurtunityData_element {
public String[] keys;
public String[] values;
public Integer limit;
private String[] keys_type_info = new String[]{'keys','http://www.w3.org/2001/XMLSchema','string','1','-1','false'};
private String[] values_type_info = new String[]{'values','http://www.w3.org/2001/XMLSchema','string','1','-1','false'};
private String[] limit_type_info = new String[]{'limit','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://test.xyz.com','true','false'};
private String[] field_order_type_info = new String[]{'keys','values','limit'};
}
public class TestWSDL {
public String endpoint_x = 'http://tempuri.org/Salesforcexyz/services/TestWSDL';
public Map<String,String> inputHttpHeaders_x;
public Map<String,String> outputHttpHeaders_x;
public String clientCertName_x;
public String clientCert_x;
public String clientCertPasswd_x;
public Integer timeout_x;
private String[] ns_map_type_info = new String[]{'http://test.xyz.com', 'testxyzCom'};
public String[] createOpurtunityData(String[] keys,String[] values,Integer limit) {
testxyzCom.createOpurtunityData_element request_x = new testxyzCom.createOpurtunityData_element();
testxyzCom.createOpurtunityDataResponse_element response_x;
request_x.keys = keys;
request_x.values = values;
request_x.limit = limit;
Map<String, testxyzCom.createOpurtunityDataResponse_element> response_map_x = new Map<String, testxyzCom.createOpurtunityDataResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'',
'http://test.xyz.com',
'createOpurtunityData',
'http://test.xyz.com',
'createOpurtunityDataResponse',
'testxyzCom.createOpurtunityDataResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.createOpurtunityDataReturn;
}
}
public class createOpurtunityDataResponse_element {
public String[] createOpurtunityDataReturn;
private String[] createOpurtunityDataReturn_type_info = new String[]{'createOpurtunityDataReturn','http://www.w3.org/2001/XMLSchema','string','1','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://test.xyz.com','true','false'};
private String[] field_order_type_info = new String[]{'createOpurtunityDataReturn'};
}
}

I've had a similar issue recently with a WSDL that generated an APEX class using the reserved keyword 'long'.
I don't think wsdl2apex is smart enough to add a suffix to reserved keywords as you suggest.
Can you do it by hand to the generated class?
In createOpurtunityData_element
public Integer limit_x;
In TestWSDL
public String[] createOpurtunityData(String[] keys,String[] values,Integer limit_x) {
request_x.limit_x = limit_x;
I'm not 100% sure how the call to WebServiceCallout.invoke will handle this change though. If you can, it would be easier to update the web service and WSDL so it doesn't use a APEX keyword.

Related

NLog DB Configration Problem For PostgreSql

I'm using nlog it's working well for log file but I want to add log info in db too.
But it's not working for me.
I couldn't find my problem.
I'm using postgresql as database.
I'm using .NET5
NLog 4.7.10
nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="allfile" xsi:type="File"
fileName="D:\BEBKA.JobTracking.logs\${shortdate}.log"/>
<target xsi:type="Database" name="db" dbProvider="Npgsql.NpgsqlConnection, Npgsql" connectionstring="Server=127.0.0.1;Port=5432;Database=BEBKAJobTracking;User Id=postgres;Password=123;">
<commandText>
INSERT INTO public."Logs"("Type", "Method", "StatusCode", "StackTrace", "MethodName", "Message", "RequestData", "ResponseData", "Ip", "CreatedDate", "CreatedId")
VALUES (#Type, #Method, #StatusCode, #StackTrace, #MethodName, #Message, #RequestData, #ResponseData, #Ip, #CreatedDate, #CreatedId);
</commandText>
<parameter name="#Type" layout="${type}"/>
<parameter name="#Method" layout="${method}"/>
<parameter name="#StatusCode" layout="${statusCode}"/>
<parameter name="#StackTrace" layout="${stackTrace}"/>
<parameter name="#MethodName" layout="${methodName}"/>
<parameter name="#Message" layout="${message}"/>
<parameter name="#RequestData" layout="${requestData}"/>
<parameter name="#ResponseData" layout="${responseData}"/>
<parameter name="#Ip" layout="${ip}"/>
<parameter name="#CreatedDate" layout="${createdDate}"/>
<parameter name="#CreatedId" layout="${createdId}"/>
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="allfile" />
<logger name="db" minlevel="Trace" writeTo="db" />
</rules>
</nlog>
My logger service
using BEBKA.Infrastructure.Abstractions.Core;
using BEBKA.Infrastructure.Abstractions.Loggger.Interfaces;
using NLog;
namespace BEBKA.Infrastructure.Services
{
public class LoggerService : ILoggerService
{
private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
public void LogDebug(ILog log)
{
logger.Debug(log.Message);
}
public void LogDebug(string message)
{
logger.Debug(message);
}
public void LogError(ILog log)
{
logger.Error(log.Message);
}
public void LogError(string message)
{
logger.Error(message);
}
public void LogInfo(ILog log)
{
//TODO: Need Bugfix
LogEventInfo theEvent = new(LogLevel.Info, "db", log.Message);
SetLogEventInfo(theEvent, log);
logger.Log(theEvent);
//logger.Info("{message}",log.Message);
}
public void LogInfo(string message)
{
logger.Info(message);
}
public void LogWarn(ILog log)
{
logger.Warn(log.Message);
}
public void LogWarn(string message)
{
logger.Warn(message);
}
private static void SetLogEventInfo(LogEventInfo theEvent, ILog
data)
{
theEvent.Properties["Type"] = data.Type;
theEvent.Properties["Method"] = data.Method;
theEvent.Properties["StatusCode"] = data.StatusCode;
theEvent.Properties["StackTrace"] = data.StackTrace;
theEvent.Properties["MethodName"] = data.MethodName;
theEvent.Properties["Message"] = data.Message;
theEvent.Properties["RequestData"] = data.RequestData;
theEvent.Properties["ResponseData"] = data.ResponseData;
theEvent.Properties["Ip"] = data.Ip;
theEvent.Properties["CreatedDate"] = data.CreatedDate;
theEvent.Properties["CreatedId"] = data.CreatedId;
}
}
}
..................................................................................................................................................................................................................................................................
You have several issues going on:
Event-Properties must be rendered with help from ${event-properties}
<parameter name="#Type" layout="${event-properties:type}"/>
<parameter name="#Method" layout="${event-properties:method}"/>
<parameter name="#StatusCode" layout="${event-properties:statusCode}"/>
<parameter name="#StackTrace" layout="${event-properties:stackTrace}"/>
<parameter name="#MethodName" layout="${event-properties:methodName}"/>
<parameter name="#Message" layout="${event-properties:message}"/>
<parameter name="#RequestData" layout="${event-properties:requestData}"/>
<parameter name="#ResponseData" layout="${event-properties:responseData}"/>
<parameter name="#Ip" layout="${event-properties:ip}"/>
<parameter name="#CreatedDate" layout="${event-properties:createdDate}"/>
<parameter name="#CreatedId" layout="${event-properties:createdId}"/>
Logger-Name should never be assigned, but must be null for filtering to work
public class LoggerService : ILoggerService
{
private static readonly ILogger logger = LogManager.GetCurrentClassLogger();
private static readonly ILogger Dblogger = LogManager.GetLogger("db");
public void LogInfo(ILog log)
{
LogEventInfo theEvent = new(LogLevel.Info, null, log.Message);
SetLogEventInfo(theEvent, log);
Dblogger.Log(theEvent); // DbLogger matches <logger name="db" minlevel="Trace" writeTo="db" />
}
It is a little confusing that all LogEventInfo-constructors takes Logger-name as input-parameter, but it should never be assigned. Tried to improve on this, but my pull-request was rejected: https://github.com/NLog/NLog/issues/4086
Notice that one could also log ILog as single object like Dblogger.Info("{payload}", data) and extract individual properties like this: ${eventproperties:payload:objectpath=CreatedId}

JPA NamedQuery not found

I'm trying to get a list of persons using JPA. Every time I run the code, I get "java.lang.IllegalArgumentException: NamedQuery of name: Persoon.getAllePersonen not found."
I tried changing the table name, replaced Persoon.getAllePersonen by getAllePersonen,.... I just can't seem to figure out what's causing the error
Persoon
#Entity
#Table(name = "Persoon")
#NamedQueries({
#NamedQuery(name = "Persoon.getAllePersonen",
query = "SELECT p FROM Persoon p"),
#NamedQuery(name = "Persoon.findByName",
query = "SELECT p FROM Persoon p WHERE p.achternaam = :persoonNaam OR p.voornaam = :persoonNaam")
})
public class Persoon implements Serializable {
PersoonDao
public List<Persoon> getAlleLeden(){
TypedQuery<Persoon> queryP = em.createNamedQuery("Persoon.getAllePersonen", Persoon.class);
try{ return queryP.getResultList();
} catch (NoResultException e){
throw new EntityNotFoundException("Cannot find leden");
}
}
EDIT:
Generic Superclass DAO
public class GenericDaoJpa<T>{
private static final EntityManagerFactory emf = Persistence.createEntityManagerFactory("TaijitanPU");
protected static final EntityManager em = emf.createEntityManager();
Persistence.xml
<?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="TaijitanPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>domein.Persoon</class>
<class>domein.Graad</class>
<class>domein.Locatie</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost\sqlexpress:1433;databaseName=Taijitan;integratedSecurity=true;"/>
<property name="javax.persistence.jdbc.user" value=""/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
You have to do an abstract class Generic class and override the entityManager of the parent class for each child. Check below. I used EJB Stateless for the childs.
-> PARENT DAO
public abstract class AbstractDAO<T> {
...
protected abstract EntityManager getEntityManager();
-> CHILD DAO
#PersistenceContext(unitName = "yourPersistenceUnitName")
private EntityManager em;
#Override
protected EntityManager getEntityManager() {
return em;
}

C# WPF XML Schema validation of abstract type

First of all I would like to say hallo everybody - it's my first post here on SO. Now important stuff. I am writing some code in C# WPF .NET 4.0 which is based on serialization / deserialization built-in mechanizms. Everything was fine untill I decided to create a validation schema for my serialized xml file. All of this would be more clear when I show a bit my code:
Serialization
private void serializeObjectsToFile(string path)
{
using (var writer = new System.IO.StreamWriter(path))
{
var serializer = new XmlSerializer(myTopClass.GetType());
serializer.Serialize(writer, myTopClass);
writer.Flush();
}
}
Deserialization
private MyTopClass deserializeObjectsFromFile(string path)
{
using (var stream = System.IO.File.OpenRead(path))
{
var serializer = new XmlSerializer(typeof(MyTopClass));
return serializer.Deserialize(stream) as MyTopClass;
}
}
Validation
private bool validateXmlAgainstSchema(string pathToFile)
{
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add("", schemaPath);
XDocument inputFile = XDocument.Load(pathToFile);
var isFileValid = true;
inputFile.Validate(schemas, (o, e) =>
{
MessageBox.Show(string.Format("Validation fails. {0}.", e.Message));
isFileValid = false;
});
return isFileValid;
}
Now let me introduce my Model which is serialized to xml file and for which I want to create a validation schema.
Top Class
namespace SerializationVsSchemaTest.Model
{
[Serializable]
public class MyTopClass
{
public int myTopItemOne { get; set; }
public int myTopItemTwo { get; set; }
public int myTopItemThree { get; set; }
public MyAbstractClass myTopAbstractItem { get; set; }
public MyTopClass()
{
myTopItemOne = 7;
myTopItemTwo = 8;
myTopItemThree = 9;
myTopAbstractItem = new ClassOne();
}
public override string ToString()
{
return string.Format("{0}\n{1}\n{2}\n{3}\n", myTopItemOne, myTopItemTwo, myTopItemThree, myTopAbstractItem.ToString());
}
}
}
Abstract Class - the most important stuff here and the root part of my question
namespace SerializationVsSchemaTest.Model
{
[XmlInclude(typeof(ClassOne))]
[XmlInclude(typeof(ClassTwo))]
public abstract class MyAbstractClass
{
}
}
ClassOne
namespace SerializationVsSchemaTest.Model
{
[Serializable]
public class ClassOne : MyAbstractClass
{
public int argOne;
public int argTwo;
public int argThree;
public ClassOne()
{
argOne = -1;
argTwo = -2;
argThree = -3;
}
}
}
ClassTwo
namespace SerializationVsSchemaTest.Model
{
[Serializable]
public class ClassTwo: MyAbstractClass
{
public byte argOne;
public byte argTwo;
public byte argThree;
public ClassTwo()
{
argOne = 4;
argTwo = 5;
argThree = 6;
}
}
}
Serialization result
<?xml version="1.0" encoding="utf-8"?>
<MyTopClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<myTopItemOne>7</myTopItemOne>
<myTopItemTwo>8</myTopItemTwo>
<myTopItemThree>9</myTopItemThree>
<myTopAbstractItem xsi:type="ClassOne">
<argOne>-1</argOne>
<argTwo>-2</argTwo>
<argThree>-3</argThree>
</myTopAbstractItem>
</MyTopClass>
My validation schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
<xsd:element name="MyTopClass">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="myTopItemOne" type="xsd:unsignedByte" />
<xsd:element name="myTopItemTwo" type="xsd:unsignedByte" />
<xsd:element name="myTopItemThree" type="xsd:unsignedByte" />
<xsd:element name="myTopAbstractItem">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="argOne" type="xsd:byte" />
<xsd:element name="argTwo" type="xsd:byte" />
<xsd:element name="argThree" type="xsd:byte" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
And the problem here is that this schema fails to validate my xml with following result:
Validation fails. Invalid type xsi:type 'ClassOne'. The strangest thing is that this schema is generated by Visual Studio 2013 using my serialized xml file. So it should match 100%... I hope You guys will help me somehow. Cheers!

NLog MethodCall

I've got a silverlight project and I'm trying to configure NLog for calling static method but it doesn't (using Nlog.config).
I'm following this example.
Here's Nlog.config code:
...
<targets>
<target name="m" xsi:type="MethodCall"
className="NLogTestSilver.MainPage, NLogTestSilver"
methodName="LogMethod">
<parameter layout="${level}" />
<parameter layout="${message}" />
</target>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="m" />
</rules>
...
Assembly name = NLogTestSilver.dll
Here's MainPage.xaml.cs code:
namespace NLogTestSilver
{
public partial class MainPage : UserControl
{
public static Logger Logger = LogManager.GetCurrentClassLogger();
public MainPage()
{
InitializeComponent();
Logger.Fatal("Fatality");
}
public static void LogMethod(string level, string message)
{
System.Windows.Browser.HtmlPage.Window.Alert(level + " " + message);
}
}
}
P.S. Programmatic configuration works well.
So it was found out that an exception is thrown in NLog.Targets.MethodCallTarget.InitializeTarget() method while processing className parameter.
If we change
className="NLogTestSilver.MainPage, NLogTestSilver"
to
className="NLogTestSilver.MainPage, NLogTestSilver,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx"
it works great.
Where xxxxxxxxxxxxxxxx is public key token of our assembley.

JPA + Google SQL + GWT + Eclipse

I'm trying to run a simple project.
I'm struggling with some issues.
I created a simple table in a database instance.
Then, following google tutorial, I set up my project in Eclipse.
I raise this error on running from localhost:
[EL Severe]: 2012-11-23 14:23:16.915--ServerSession(1241461653)--Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
---------------------------------------------------------
Exception [EclipseLink-60] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [set] or [get] is not defined in the object [com.shared.Main].
Internal Exception: java.lang.NoSuchMethodException: com.shared.Main.get(java.lang.String)
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[id-->main.ID]
Descriptor: RelationalDescriptor(com.shared.Main --> [DatabaseTable(main)])
Exception [EclipseLink-60] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [set] or [get] is not defined in the object [com.shared.Main].
Internal Exception: java.lang.NoSuchMethodException: com.shared.Main.get(java.lang.String)
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[name-->main.NAME]
Descriptor: RelationalDescriptor(com.shared.Main --> [DatabaseTable(main)])
It seems that eclipse link can't find getter and setter for my object...
Any clue?
My 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" transaction-type="RESOURCE_LOCAL">
<provider></provider>
<mapping-file>META-INF/eclipselink-orm.xml</mapping-file>
<properties>
<property name="datanucleus.NontransactionalRead" value="true"/>
<property name="datanucleus.NontransactionalWrite" value="true"/>
<property name="datanucleus.ConnectionURL" value="appengine"/>
<property name="javax.persistence.jdbc.driver" value="com.google.appengine.api.rdbms.AppEngineDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:google:rdbms://myinstance/test_jpa"/>
<property name="javax.persistence.jdbc.user" value="myuser"/>
<property name="javax.persistence.jdbc.password" value="mypassword"/>
</properties>
</persistence-unit>
</persistence>
My eclipse-orm.xml:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.4" xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd">
<entity class="com.shared.Main" access="VIRTUAL">
<attributes>
<id name="id" attribute-type="int">
<generated-value strategy="AUTO"/>
</id>
<basic name="name" attribute-type="String">
</basic>
</attributes>
</entity>
</entity-mappings>
My Object:
package com.shared;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the main database table.
*
*/
#Entity
#Table(name="main")
public class Main implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
#Column(unique=true, nullable=false)
private int id;
#Column(length=50)
private String name;
public Main() {
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}
Your shared folder exists (also) on client. The client can not know anything about databases. SQL etc. Remove all database relations from shared to server.
The problem was solved removing the link to the orm file in persistance.xml:
<mapping-file>META-INF/eclipselink-orm.xml</mapping-file>
and adding direct mapping to classes
<class>org.my.package.MyClass</class>

Resources