on 09-29-2009 10:22 AM
Hi,
I'm working with NWDS 7.10 SP8 and I'm trying to generate Entities directly from a DB (MaxDB 7.6).
It does not generate any Classes. I created in the Datasource Explorer the connection to the DB. I can see there every Databasetable, so the connection is working.
I have a development component EJB 3.0 and added Java persistence facet manually to it. I selected the connection from above and get now the Menu Entry "JPA". There I "Generate Entities", see my DB tables and select the required one. If I say finish - nothing - happens. Nothing means NO ERROR, just window is closing and nothing is generated in the given package.
If I try the same on a DDIC project I get my classes generated... So here it does work.
Do I miss something when generating directly from a Database via Datasource Explorer? From reading the help I get the impression it should work this way. Or is it just another annoying bug from NWDS?
Best regards,
Frank
From the error log, so something goes wrong at NWDS. A few classes I could generate one by one... For others I get:
Hi Frank,
SAP JPA can work very well with foreign-key-constraints on the database. Unfortunately, this behaviour has to be enabled by the property
<property name = "com.sap.jpa.execution.foreign-key-handling" value = "topological"/>
in the properties section of persistence-unit in persistence.xml. The details are documented here: http://help.sap.com/saphelp_nwce72/helpdata/en/f6/8266852de140d8a9ee8e850cce4fea/frameset.htm.
-Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Copied in second message as first gets unreadable...
eclipse.buildId=I20070625-1500
java.version=1.5.0_18
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86 -data D:\Dokumente\Projekte\workspace
Error
Tue Sep 29 11:30:49 CEST 2009
Unhandled event loop exception
java.lang.NullPointerException
at org.eclipse.jpt.db.internal.ForeignKey.getReferencedTable(ForeignKey.java:104)
at org.eclipse.jpt.gen.internal.GenTable.addReferencedTablesTo(GenTable.java:106)
at org.eclipse.jpt.gen.internal.GenScope.buildReferencedTables(GenScope.java:169)
at org.eclipse.jpt.gen.internal.GenScope.configureManyToManyRelations(GenScope.java:81)
at org.eclipse.jpt.gen.internal.GenScope.initialize(GenScope.java:46)
at org.eclipse.jpt.gen.internal.GenScope.<init>(GenScope.java:33)
at org.eclipse.jpt.gen.internal.PackageGenerator.<init>(PackageGenerator.java:48)
at org.eclipse.jpt.gen.internal.PackageGenerator.generateEntities(PackageGenerator.java:38)
at org.eclipse.jpt.ui.internal.generic.EntitiesGenerator$GenerateEntitiesRunnable.run(EntitiesGenerator.java:129)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1779)
...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found this sentence on the help:
The JPA implementation underlying the SAP NetWeaver Application Server Java expects that there are no foreign key constraints on the database. If foreign key constraints exist, the behavior is undefined.
I think this explains... lol Database Design without foreign keys... Welcome to the SAP world... From day to day I understand more why SAP strategy is back to ABAP.
Seems that this is a known problem with MAXDB driver. It was reported in Eclipse bugzilla as:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205887
which duplicates:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=231286
and it has been fixed for MAXDB v.7.6.04.03 (or newer).
Best wishes!
Stefan Dimov
Hello,
thank you very much, but with the statement from SAP Help I don't feel confident to try with foreign keys. Anyway our MaxDB is 7.6.03 Version, so I will give it a try when our Admin has updatet DB Version.
But even without Foreign Keys Problems continue. At runtime I get:
Caused by: java.lang.RuntimeException: The persistence unit is inconsistent with the database schema:
Error on attribute >>de.aseaco.uif.adm.db.UifAdmFunction$PK.uifFunction<<: The column >>UIF_ADM_FUNCTION.UIFFUNCTION<< does not exist.
...
At database the Column is named UIF_FUNCTION, the framework has not generated any @Column statement on fields of Primary Keys with more then one field... This results in Stack Overflow Errors.
Frank
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.