java.lang.StackOverflowError in context with UCanAccess and JPA - jpa

When I try to perform a JPA-Query, the UCanAccess Driver quits with a java.lang.StackOverflowError.
This used call is as simple as can be. With another Table this db request works fine.
final Tbltitel entity = (Tbltitel) entityManager.createNamedQuery("Tbltitel.findById")
.setParameter("id", new Integer(14199)).getSingleResult();
The call with plain JDBC and the call via Jackcess against this table works also fine, so I guess, something went wrong with the UCanAccess Driver in Context with JPA.
A complete Eclipse Project with the Database and the JUnit Tests can be downloaded at "https://app.box.com/s/mun1se9y7gji24kg6xrx"
My set up:
Windows 7 Professional 64 bit
Microsoft Office 2013
NetBeans IDE 8.0
Java 1.8
UCanAccess-2.0.7-bin

As I said this issue seems to be related to EclipseLink and not to UCanAccess.
Setting the annotation #Cacheable(false) on the class Tbllistofvalues, which is autoreferential, should solve the issue.

Related

How can I fix missing derby ClientDriver issue?

I am pretty new to java DB and I'm trying to set up Java DB in NetBeans IDE using this tutorial: https://netbeans.org/kb/docs/ide/java-db.html
During the step, where it tells to create database, I get such an error:
An error occurred while creating the database: java.lang.ClassNotFoundException: org.apache.derby.jdbc.Clientdriver
How do I fix this issue?
Which version of Derby / JavaDB are you using?
If it is 10.15.1.3, see this response: Where is org.apache.derby.jdbc.ClientDriver for version 10.15.1.3?
Within Netbeans there seems to be the same issue with ClientDriver. As a workaround, download and use Derby 10.14.2.0 instead. A Netbeans bug report Apache JIRA Netbeans-3424 (https://issues.apache.org/jira/browse/NETBEANS-3424) has been submitted.
I found it in lib\derbytools.jar\org\apache\derby\jdbc
copied the entire jdbc folder and pasted in lib\derbyclient.jar\org\apache\derby
then it works.
Goodbye.

Reverse Engineering Code First With MySQL

Can someone help me with this problem??. I want use "Reverse Engineering Code First" with entity framework used MySQL. I was installed odbc, connector .net etc but still I cant see this... I did everything in this topic (and I have this same problem): Can't use a MySQL connection for entity framework 6
but still doesnt work :(. I was record all steps what I do it.. (Sry for english): https://youtu.be/xqEgCsu7_eU
I've gotten it to work with MySql Connector 6.9.11. Its so darned difficult and fragile I'm not sure if it was ultimately a good idea. There are at least 10 things that can go wrong and suck up hours of time. Once you get it working be very careful to not change anything. Anyhow. Here's some of my notes:
WARNING use with MySQL server 5.6.39 or 5.7.19. Do NOT use MySQL server version 5.7.21 (it fails with reverse eng) Aurora seems ok.
Install "mysql-connector-net-6.9.11.msi". There seems to be a problem with newer MySQL Connector 6.10 ?? use older 6.9.11. MUST INSTALL VIA msi file. Having the local file is not enough.
Install "mysql-for-visualstudio-1.2.8.msi" or "mysql-for-visualstudio-1.2.7.msi" ? NOTE: 1.2.7 will never uninstall correctly. VS 2015 seems to require "MySQL for Visual Studio" for EF Poco to work, (Pro,Enterprise are different)
Must have "Entity Framework Power tools Beta 4" installed as a plugin to Visual Studio 2013. Its takes some effort to get it to install for 2015, 17 but it can be done.
https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d
Things that can go wrong:
ISSUE 1:
you get error "One or more errors occurred while processing template 'Entity.tt'."
This ALWAYS happens the first time i use reverse engineer after restarting VS.
Simply changing the .NET assemmbly version seems to do the trick. Target .NET 4.5 (not 4.5.1) for reverse engineer.
use .net4.5 for EF. If you see exception "System.ArgumentException: Empty path name is not legal."
remember to change back to 4.5.2 or greater.
VS2015 Edit and Continue is supported for 64-bit projects that target the .NET Framework 4.5.1. (or 4.5.2)
ISSUE 2:
System.ArgumentException: The specified store provider 'MySql.Data.MySqlClient' cannot be found in the configuration, or 'MySql.Data.MySqlClient' is not valid.
This appears to be an app/web.config issue.
??? MySql.Data.MySqlClient has more than 1 entry in in app.config ?? or bindingRedirect is wrong ?? might be wrong version consistently 6.9.11 ? MySql.Data.MySqlClient
?? Install correct version 6.9.11 in GAC not just nuget ? mysql-connector-net-6.9.11.msi
ISSUE 3:
MySQL issue - "error 6003: The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull." Specified cast is not valid.
[1 Jan 2016 15:27] "Noman Khan. Run the following command on the MySQL DB and then try if this works. set global optimizer_switch='derived_merge=off'" (on the user you will use. i.e root)
ISSUE 4:
Out of memory execption. Restart VisualStudio.
ISSUE 5:
If "MySQL" option doesnt display in the "Change Data source" listbox. Install the Visual Studio MySQL Plugin
Can't use a MySQL connection for entity framework 6
NOTE:
EntityFrameworkPowerToolsBeta4 is not built for VS2015 or 17. The installer version must be modified for it to install
How to use Entity Framework Power Tools in Visual Studio 2015?
http://thedatafarm.com/data-access/installing-ef-power-tools-into-vs2015/
NOTE:
You can view the Generated SQL query by debugging/break on the object prior to deferred execution of the query.
You can Use Aliases to map to other db's
Watch out for poor pluralization rules like "Statu" to "Status"
Check out https://us.visualstudiogallery.msdn.microsoft.com/ee4fcff9-0c4c-4179-afd9-7a2fb90f5838/view/Discussions
This seems to be more configurable and better supported. But only works for MSSQL?

Missing NamedQueries annotation in WAS Liberty environment

I'm using WAS Liberty 8.5.5.5 under Java 7 (tried under Oracle java 7-8 and IBM java 7 as well).
When I create one NamedQuery, the code compiles, deployes, and runs fine.
However, If I try to use the NamedQueries annotation I get the following excpetion:
java.lang.ArrayStoreException: com.sun.proxy.$Proxy29
at sun.reflect.annotation.AnnotationParser.parseAnnotationArray(AnnotationParser.java:765)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:537)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
After some investigation, I found the following two bugs:
ArrayStoreException in Jboss: https://issues.jboss.org/browse/JBAS-9392
ArrayStoreException when annotation declaring class missing: http://bugs.java.com/view_bug.do?bug_id=7183985
It seems that the javax.persistence.NamedQueries inteface is missing in the enviroment (stangely the javax.persinstence.NameQuery is present ...)
I use Eclipse Kepler for development, the deployment is also handled by the IDE.
On more thing; other developers using the same code base can successfully deploy and run the application with the afformentioned settings - so I suspect the deployment might be responsible for this issue.
Is there a way to "tell" the WAS to include the missing class runtime?
It took some time, but I found the solution.
We are using Ecliselink as a JPA provider, and load it accordingly:
<classloader commonLibraryRef="EclipseLinkLib" delegation="parentLast"/>
It seems that Eclipselink (version 2.5.2) contains the javax.persistence.NamedQuery interface, but not the javax.persistence.NamedQueries interface - this way WAS does not load the missing interface.
By changing delegation="parentFirst" the app works fine.

Eclipse not creating JPA entities from table

I'm using Eclipse Juno, Hibernate 4.0 and MSSQL 2008.
I've created a database and have just gone through the process "JPA Entities from Tables" in Eclipse. About half of the tables did not get created (even though I selected those table), but the classes were added to persistence.xml.
Has anyone else experienced this problem? Do you have a solution?
In my case the database was Oracle XE. So mine is a bit different case but may be helpful to someone.
The best way to find the problem with this is to check the logs of workspace present at $workspace_location/.metadata/.log file. In my case I found that there were 3 problems:
1) Caused by: java.io.FileNotFoundException: $MiddlewarePath\oracle_common\modules\oracle.adf.share_11.1.1\adfsharembean.jar (Access is denied)
2) Caused by: java.io.FileNotFoundException: $MiddlewarePath\oracle_common\modules\oracle.ldap_11.1.1\jremtool.jar (Access is denied)
3) !MESSAGE Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen
!STACK 1
Java Model Exception: Core Exception [code 275] A resource exists with a different case: '/TestJPAProjectFacetsEJB/src/main/java/com/domainname/ejb/TestJPAProjectFacets'.
Hence I did the following:
1) Provided access permission for the jar files
2) While I was generating entities I was giving the package name as com/domainname/ejb/testjpaprojectfacets/model. But I was already having a package com/domainname/ejb/TestJPAProjectFacets hence the error. I then renamed my existing package to all lowercase (com/domainname/ejb/testjpaprojectfacets) and it worked.
Thanks,
Sanjay
My workaround was to use the JTDS JDBC Driver to connect to SQL Server database instead of the Microsoft SQL Server JDBC Driver
This sounds like Eclipse DTP bug 282206. Dali (the Eclipse project that supplies the Entity Generation wizard you are using) depends on the Eclipse DTP project for retrieving from various database servers the necessary meta-data to generate entities. The MS SQL Server "driver" you are using (i.e. the plug-in used by DTP to adapt the MS SQL JDBC driver to the DTP SPI interfaces - by default this plug-in is org.eclipse.datatools.enablement.msft.sqlserver... - it is a bit confusing that the DTP developers like to call these plug-ins "drivers"....) has a bug in the meta-data it returns to Dali, preventing Dali from generating entities.
I faced this issue too.
My workaround - Created the database in MySQL and generated entities from there. The generated entity classes work with SQL Server as well. Not faced any other side-effects (so far)

Eclipse JPA project - defining connection to Oracle RAC

Recently I wanted to play a bit with Eclipse and JPA. Thus I wanted to create a JPA project.
I got stuck when specifying the database connection, as editing the "Connection URL" (shown on the image) is not possible and I want to enter a (good, working) connection string to an Oracle RAC server which looks more or less like that:
jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS= (PROTOCOL=TCP) (HOST=...
Am I doing something obviously wrong? Or is it a "feature" of the Data Source Explorer?
Screenshot from Eclipse http://img706.imageshack.us/img706/4876/stacku.png
See Oracle's FAQ for syntax of the database connection string.