Internal exception with horizontal mapping
When two horizontally mapped classes stored with the same ID system comits
work to database and the throws internal exception. As result corrupt data
is saved which can not be read back
1469 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 20089978> [0 ms]
executing prepstmnt 3972145 SELECT DISTINCT JDO_CLASS FROM TEST.CONTRACT
1500 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 24257622> [0 ms]
executing prepstmnt 9649099 SELECT t0.JDO_CLASS, t0.JDO_LOCK FROM
TEST.CONTRACT t0 WHERE t0.CONTRACT_ID = ? [params=(long) 1]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 10233621 INSERT INTO TEST.ORGANIZATION (ACRONYM,
CONTRACT_ID, JDO_CLASS, JDO_LOCK, NAME, ORG_ID) VALUES (?, ?, ?, ?, ?, ?)
[params=(null) null, (long) 1, (String) com.peacetech.test.jdo.Organization,
(int) 0, (null) null, (long) 3]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 3823508 INSERT INTO TEST.PERSON (CONTRACT_ID, JDO_CLASS,
JDO_LOCK, NAME, NICK_NAME, ORG_ID, PERSON_ID) VALUES (?, ?, ?, ?, ?, ?, ?)
[params=(long) 1, (String) com.peacetech.test.jdo.Person, (int) 0, (null)
null, (null) null, (long) 3, (long) 3]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 4973260 INSERT INTO TEST.POST (CONTRACT_ID, JDO_CLASS,
JDO_LOCK, NAME, ORG_ID, POST_ID, TITLE) VALUES (?, ?, ?, ?, ?, ?, ?)
[params=(long) 1, (String) com.peacetech.test.jdo.Post, (int) 0, (null)
null, (long) 3, (long) 3, (null) null]
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
:: 3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.UserException: Can only perform operation while a transaction is
active.
at
kodo.runtime.PersistenceManagerImpl.assertActiveTransaction(PersistenceManag
erImpl.java:3602)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:840)
at kodo.runtime.LocalManagedRuntime.rollback(LocalManagedRuntime.java:125)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:101)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
:: 3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Exception in thread "main" kodo.util.FatalInternalException: 3 ::
3:kodo.runtime.PNonTransState@129b0e1 ::
3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Process terminated with exit code 1
Note that this bug is reported at:
http://bugzilla.solarmetric.com/show_bug.cgi?id=940
Currently, the only solution is to ensure that you are using globally
unique IDs. One good way of doing this is to use an application identity
hierarchy that mirrors the hierarchy of the persistent classes, as
described in the documentation at:
http://docs.solarmetric.com/manual.html#horizontal_caveats.
In article <[email protected]>, Alex Roytman wrote:
When two horizontally mapped classes stored with the same ID system comits
work to database and the throws internal exception. As result corrupt data
is saved which can not be read back
1469 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 20089978> [0 ms]
executing prepstmnt 3972145 SELECT DISTINCT JDO_CLASS FROM TEST.CONTRACT
1500 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 24257622> [0 ms]
executing prepstmnt 9649099 SELECT t0.JDO_CLASS, t0.JDO_LOCK FROM
TEST.CONTRACT t0 WHERE t0.CONTRACT_ID = ? [params=(long) 1]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 10233621 INSERT INTO TEST.ORGANIZATION (ACRONYM,
CONTRACT_ID, JDO_CLASS, JDO_LOCK, NAME, ORG_ID) VALUES (?, ?, ?, ?, ?, ?)
[params=(null) null, (long) 1, (String) com.peacetech.test.jdo.Organization,
(int) 0, (null) null, (long) 3]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 3823508 INSERT INTO TEST.PERSON (CONTRACT_ID, JDO_CLASS,
JDO_LOCK, NAME, NICK_NAME, ORG_ID, PERSON_ID) VALUES (?, ?, ?, ?, ?, ?, ?)
[params=(long) 1, (String) com.peacetech.test.jdo.Person, (int) 0, (null)
null, (null) null, (long) 3, (long) 3]
1563 TRACE [main] kodo.jdbc.SQL - <t 20688146, conn 30008954> [0 ms]
executing prepstmnt 4973260 INSERT INTO TEST.POST (CONTRACT_ID, JDO_CLASS,
JDO_LOCK, NAME, ORG_ID, POST_ID, TITLE) VALUES (?, ?, ?, ?, ?, ?, ?)
[params=(long) 1, (String) com.peacetech.test.jdo.Post, (int) 0, (null)
null, (long) 3, (long) 3, (null) null]
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
:: 3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.UserException: Can only perform operation while a transaction is
active.
at
kodo.runtime.PersistenceManagerImpl.assertActiveTransaction(PersistenceManag
erImpl.java:3602)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:840)
at kodo.runtime.LocalManagedRuntime.rollback(LocalManagedRuntime.java:125)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:101)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
1594 TRACE [main] kodo.Runtime - An exception occurred while ending the
transaction. This exception will be re-thrown.
kodo.util.FatalInternalException: 3 :: 3:kodo.runtime.PNonTransState@129b0e1
:: 3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Exception in thread "main" kodo.util.FatalInternalException: 3 ::
3:kodo.runtime.PNonTransState@129b0e1 ::
3:kodo.runtime.PNonTransState@129b0e1
at
kodo.runtime.PersistenceManagerImpl.setStateManager(PersistenceManagerImpl.j
ava:3314)
at kodo.runtime.StateManagerImpl.commit(StateManagerImpl.java:737)
at
kodo.runtime.PersistenceManagerImpl.endTransaction(PersistenceManagerImpl.ja
va:1103)
at
kodo.runtime.PersistenceManagerImpl.afterCompletion(PersistenceManagerImpl.j
ava:842)
at kodo.runtime.LocalManagedRuntime.commit(LocalManagedRuntime.java:86)
at
kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:542)
at
com.peacetech.test.jdo.TestJDOHelper.commitTransaction(TestJDOHelper.java:40
at com.peacetech.test.HorizontalTest.insert(HorizontalTest.java:57)
at com.peacetech.test.HorizontalTest.main(HorizontalTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:495)
at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
Process terminated with exit code 1
Marc Prud'hommeaux
SolarMetric Inc.
Similar Messages
-
Horizontal mapping with inverse-owner doesn't work
Hi,
We encountered a problem of using inverse-owner with horizontal mapping.
Here is the example.
public abstract class A {
//collection of class T
private Set ts = new HashSet()
public class B extends A {
private String name;
public class T {
private A owner;
private String text;
we use metadata factory. package.jdo looks like this.
<class name="T"/>
<class name="A">
<extension vendor-name="kodo" key="jdbc-class-map" value="horizontal"/>
<field name="ts">
<collection element-type="T"/>
<extension vendor-name="kodo" key="inverse-owner"
value="owner"/>
</field>
</class>
<class name="B" persistence-capable-superclass="A">
</class>
mappingtool gives java.lang.ClassCastException
at kodo.jdbc.meta.OneToManyFieldMapping.map(OneToManyFieldMapping.java:126)Fred-
This is a bug in the automatic generation of mappings. See:
http://bugzilla.solarmetric.com/show_bug.cgi?id=1096
Note this this bug only seems to apply to the automatic generation of
mappings: if you manually compose the .mapping file, then you can
express the one-many mapping (provided you can cast it down to a single
concrete type with the "type" extension).
See the bug report page for an example mapping file solution.
In article <[email protected]>, Fred Chen wrote:
Hi,
When using horizontal mappings, you cannot have an inverse type relation
to a horizontally mapped class (there is no table to hold the
inverse!)But that is precisely why we want to use the inverse mapping (to AVOID the
unecessary middle table). Can you explain in a bit more detail why this is
not supported?
Thanks,
Fred
"Stephen Kim" <[email protected]> wrote in message
news:[email protected]...
When using horizontal mappings, you cannot have an inverse type relation
to a horizontally mapped class (there is no table to hold the
inverse!). However, if you have a concrete type that it is always
mapped to, you can indicate that using the type and element-type
extensions to override the Java declarations to the concrete mapped type.
Fred Chen wrote:
Hi,
We encountered a problem of using inverse-owner with horizontal mapping.
Here is the example.
public abstract class A {
//collection of class T
private Set ts = new HashSet()
public class B extends A {
private String name;
public class T {
private A owner;
private String text;
we use metadata factory. package.jdo looks like this.
<class name="T"/>
<class name="A">
<extension vendor-name="kodo" key="jdbc-class-map" value="horizontal"/>
<field name="ts">
<collection element-type="T"/>
<extension vendor-name="kodo" key="inverse-owner"
value="owner"/>
</field>
</class>
<class name="B" persistence-capable-superclass="A">
</class>
mappingtool gives java.lang.ClassCastException
at
kodo.jdbc.meta.OneToManyFieldMapping.map(OneToManyFieldMapping.java:126)
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com
Marc Prud'hommeaux
SolarMetric Inc. -
Finding exception with the read-write-backing-map-scheme configuration.
Finding exception with the <read-write-backing-map-scheme> configuration, that is setup against a simple database cache store implementation. The class SimpleCacheEventStoreImpl implements CacheStore interface.
Exception in thread "main" java.lang.UnsupportedOperationException: configureCache: read-write-backing-map-scheme
at com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(DefaultConfigurableCacheFactory.java:995)
at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultConfigurableCacheFactory.java:277)
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:689)
at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:667)
at Sample.SimpleEventStoreConsumer.main(SimpleEventStoreConsumer.java:10)
The cache store is interfaced to the program SimpleEventStoreConsumer(where I have a put and get operation) through the following cache configuration descriptor. On running the SimpleEventStoreConsumer, the exception happens on trying to get the Named cache from the cache factory
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>Evt*</cache-name>
<scheme-name>SampleDatabaseScheme</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<read-write-backing-map-scheme>
<scheme-name>SampleDatabaseScheme</scheme-name>
<internal-cache-scheme>
<local-scheme>
<scheme-ref>SampleMemoryScheme</scheme-ref>
</local-scheme>
</internal-cache-scheme>
<cachestore-scheme>
<class-scheme>
<class-name>com.emc.srm.cachestore.SimpleCacheEventStoreImpl</class-name>
<init-params>
<init-param>
<param-type>java.lang.String</param-type>
<param-value>{cache-name}</param-value>
</init-param>
</init-params>
</class-scheme>
</cachestore-scheme>
</read-write-backing-map-scheme>
<local-scheme>
<scheme-name>SampleMemoryScheme</scheme-name>
</local-scheme>
</caching-schemes>
</cache-config>you are missing <backing-map-scheme>. Do like following:
<caching-schemes>
<distributed-scheme>
<scheme-name>distributed-scheme</scheme-name>
<service-name>DistributedQueryCache</service-name>
<backing-map-scheme>
<read-write-backing-map-scheme>
<scheme-ref>rw-bm</scheme-ref>
</read-write-backing-map-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
<read-write-backing-map-scheme>
<scheme-name>rw-bm</scheme-name>
<internal-cache-scheme>
<local-scheme>
</local-scheme>
</internal-cache-scheme>
</read-write-backing-map-scheme>
</caching-schemes> -
Horizontal Mapping and Flat mapping with Metadata Value Indicator
Hi
I have an abstract class B which itself extends another abstract class A.
There is no table for A. The fields in A are mapped to B. I believe this
is called "horizontal mapping"
C and D inherit off B. There's a also a table named B (mapped to class B),
but none for C or D. Instances of C and D are recorded in table B. I
believe this is called "flat mapping"
B has a field foo whose possible values are 'fred' and 'wilma'.
If foo='fred', then the record is of type C
If foo='wilma', then the record is of type D
I believe this is called "class indicator" of type metadata.
To express this, I have package.jdo which says
<class name="A"/>
<class name="B" persistence-capable-superclass="A"/>
<class name="C" persistence-capable-superclass="B"/>
<class name="D" persistence-capable-superclass="B"/>
In B.mapping, I have
<mapping>
<package name="domain">
<class name="B">
<jdbc-class-map type="horizontal"/>
<jdbc-class-ind type="metadata-value" column="foo"/>
</class>
</package>
</mapping>
B.java has a private String foo.
In C.mapping, I have
<mapping>
<package name="domain">
<class name="C">
<jdbc-class-map type="flat"/>
<jdbc-class-ind-value value="fred"/>
field mappings for C
</class>
</package>
</mapping>
and similarly in D for value='wilma'
My questions are...
1. Is this kind of mapping supported by kodo?
2. If so, is this configuration correct? I guess not, since I don't
specify the table name anywhere. Where should it go?
3. If I remove the "class indicator" mapping and run a simple test I get
kodo.util.FatalUserException: There is no superclass mapping for mapping
for "class domain.D".
at
kodo.jdbc.meta.FlatClassMapping.assertParentMapping(FlatClassMapping.java:49)
at kodo.jdbc.meta.FlatClassMapping.getTable(FlatClassMapping.java:85)
at
kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:87)
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:443)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:949)
4. If I run a simple test with the horizontal, flat and class-indicator
mappings, I get
kodo.jdbc.meta.MappingInfoNotFoundException: The "class-column"
attribute/extension for the class indicator on type
"domain.B.<class-indicator>" is missing or names a column that does not
exist.
at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:135)
at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:121)
at
kodo.jdbc.meta.ColumnClassIndicator.fromMappingInfo(ColumnClassIndicator.java:95)
at
kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java:135)
at
kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:378)
What am I doing wrong?
Thanks in advance
SriniI solved this problem by removing the identifier field from the
class/mapping (kodo support).
Thanks
Srini
Stephen Kim wrote:
Do you have two fields mapped to the same column? Did you make sure you
set everything which maps to the column?
Srinivasan Ranganathan wrote:
I found what was wrong with this, fixed it and got a different (more
sensible) error. To correct this mapping, I specified B's mapping type as
"base" and gave its table and pk names. Also, I moved the common field
mappings to B.mapping so C.mapping and D.mapping only have fields that are
specific to each.
Now when I run a simple test, I get
testC:
kodo.util.FatalUserException: Attempt to set column "B.FOO" to two
different values: (java.lang.Object)"java.lang.Object@2f608ac2",
(java.lang.String)"fred" This can occur when you fail to set both sides of
a two-sided relation between objects, or when you map different fields to
the same column, but you do not keep the values of these fields in synch.
at kodo.jdbc.runtime.VRow.setObjectInternal(VRow.java(Compiled Code))
at kodo.jdbc.sql.AbstractRow.setObject(AbstractRow.java(Compiled Code))
at
kodo.jdbc.meta.ColumnClassIndicator.insert(ColumnClassIndicator.java:143)
at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:216)
at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:219)
at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:108)
at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:73)
testD:
kodo.util.FatalUserException: Attempt to set column "B.FOO" to two
different values: (java.lang.Object)"java.lang.Object@2f608ac2",
(java.lang.String)"wilma" This can occur when you fail to set both sides
of a two-sided relation between objects, or when you map different fields
to the same column, but you do not keep the values of these fields in
synch.
at kodo.jdbc.runtime.VRow.setObjectInternal(VRow.java(Compiled Code))
at kodo.jdbc.sql.AbstractRow.setObject(AbstractRow.java(Compiled Code))
at
kodo.jdbc.meta.ColumnClassIndicator.insert(ColumnClassIndicator.java:143)
at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:216)
at kodo.jdbc.runtime.UpdateManagerImpl.insert(UpdateManagerImpl.java:219)
at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:108)
at kodo.jdbc.runtime.UpdateManagerImpl.flush(UpdateManagerImpl.java:73)
I've checked for the two possible errors to the best of my knowledge. Any
input to resolve this issue is appreciated.
Thanks in advance
Srini
Srinivasan Ranganathan wrote:
Hi
I have an abstract class B which itself extends another abstract class A.
There is no table for A. The fields in A are mapped to B. I believe this
is called "horizontal mapping"
C and D inherit off B. There's a also a table named B (mapped to class B),
but none for C or D. Instances of C and D are recorded in table B. I
believe this is called "flat mapping"
B has a field foo whose possible values are 'fred' and 'wilma'.
If foo='fred', then the record is of type C
If foo='wilma', then the record is of type D
I believe this is called "class indicator" of type metadata.
To express this, I have package.jdo which says
<class name="A"/>
<class name="B" persistence-capable-superclass="A"/>
<class name="C" persistence-capable-superclass="B"/>
<class name="D" persistence-capable-superclass="B"/>
In B.mapping, I have
<mapping>
<package name="domain">
<class name="B">
<jdbc-class-map type="horizontal"/>
<jdbc-class-ind type="metadata-value" column="foo"/>
</class>
</package>
</mapping>
B.java has a private String foo.
In C.mapping, I have
<mapping>
<package name="domain">
<class name="C">
<jdbc-class-map type="flat"/>
<jdbc-class-ind-value value="fred"/>
field mappings for C
</class>
</package>
</mapping>
and similarly in D for value='wilma'
My questions are...
1. Is this kind of mapping supported by kodo?
2. If so, is this configuration correct? I guess not, since I don't
specify the table name anywhere. Where should it go?
3. If I remove the "class indicator" mapping and run a simple test I get
kodo.util.FatalUserException: There is no superclass mapping for mapping
for "class domain.D".
at
kodo.jdbc.meta.FlatClassMapping.assertParentMapping(FlatClassMapping.java:49)
at kodo.jdbc.meta.FlatClassMapping.getTable(FlatClassMapping.java:85)
at
kodo.jdbc.meta.OneToManyFieldMapping.fromMappingInfo(OneToManyFieldMapping.java:87)
>>
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingProvider.java:160)
>>
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:443)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:949)
>>
>>
>>
>>
4. If I run a simple test with the horizontal, flat and class-indicator
mappings, I get
kodo.jdbc.meta.MappingInfoNotFoundException: The "class-column"
attribute/extension for the class indicator on type
"domain.B.<class-indicator>" is missing or names a column that does not
exist.
at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:135)
at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:121)
at
kodo.jdbc.meta.ColumnClassIndicator.fromMappingInfo(ColumnClassIndicator.java:95)
>>
at
kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvider.java:135)
>>
at
kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository.java:378)
>>
>>
>>
What am I doing wrong?
Thanks in advance
Srini
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com -
i am using toplink 10.1.3.0.0 with oracle app server 10.1.2.2, i am using change field optimistic locking and generating the project xml,
application runs great locally in the jdeveloper, but when it is deployed on app server getting following error
here are the headers from both my project.xml as well as session xml..
<?xml version="1.0" encoding="UTF-8"?>
<toplink:object-persistence version="Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)" xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<opm:name>PROJ</opm:name>
<opm:class-mapping-descriptors>
<opm:class-mapping-descriptor xsi:type="toplink:relational-class-mapping-descriptor">
<?xml version="1.0" encoding="UTF-8"?>
<toplink-sessions version="4.5" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<session xsi:type="server-session">
<name>PROJSession</name>
<event-listener-classes/>
<logging xsi:type="toplink-log">
<log-level>finer</log-level>
</logging>
<primary-project xsi:type="xml">PROJ.xml</primary-project>
<login xsi:type="database-login">
<platform-class>oracle.toplink.platform.database.oracle.OraclePlatform</platform-class>
<user-name></user-name>
any help/idea appreciated...
Exception [TOPLINK-9005] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.SessionLoaderException
Exception Description: An exception was thrown while loading the <project-xml> file [PROJ.xml].
Internal Exception: Exception [TOPLINK-25004] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.XMLMarshalException
Exception Description: An error occurred unmarshalling the document
Internal Exception: Exception [TOPLINK-27101] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.platform.xml.XMLPlatformException
Exception Description: An error occurred while parsing the document.
Internal Exception: oracle.xml.parser.v2.XMLParseException: xsi:type "toplink:changed-field-locking-policy" not resolved to a type definition
at oracle.toplink.exceptions.SessionLoaderException.failedToLoadProjectXml(SessionLoaderException.java:74)
at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.loadProjectConfig(TopLinkSessionsFactory.java:316)
at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.createSession(TopLinkSessionsFactory.java:241)
at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildServerSessionConfig(TopLinkSessionsFactory.java:215)
at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildSession(TopLinkSessionsFactory.java:168)
at oracle.toplink.tools.sessionconfiguration.TopLinkSessionsFactory.buildTopLinkSessions(TopLinkSessionsFactory.java:124)
at oracle.toplink.tools.sessionconfiguration.XMLSessionConfigLoader.load(XMLSessionConfigLoader.java:103)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:367)
at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:334)
at myProjectPackage.common.data.toplink.ToplinkDataManagerPeer.<init>(ToplinkDataManagerPeer.java:41)
at myProjectPackage.common.data.DataManagerFactory.getDataManagerInstance(DataManagerFactory.java:40)
at myProjectPackage.common.servlet.NYSDOTFilter.getDataManager(NYSDOTFilter.java:964)
at myProjectPackage.common.servlet.NYSDOTFilter.doFilter(NYSDOTFilter.java:144)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at myProjectPackage.caf.servlet.NYSDOTCAFFilter.doFilter(NYSDOTCAFFilter.java:90)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
at myProjectPackage.common.servlet.NYSDOTLoginFilter.doFilter(NYSDOTLoginFilter.java:95)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:669)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:228)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:570)first thanks for your reply,
i already figured that out and deployed it using 10.1.3.1 jars
my question
1) if it is a bug , how come it works fine with jdeveloper (
i would appreciate if you could provide any info about it.
2) i dont want to sound sarcastic , but 10.1.3.1 has of optimistic locking and the recommended solution i found was to use descriptor.getQueryManager().setUpdateCallCacheSize(0);
looks like 10.1.3.1 fixed one bug and introduced other one which was working fine earlier...
is there any other way of fixing optimistic locking issue other than using the
descriptor.getQueryManager().setUpdateCallCacheSize(0);
where i can find the latest/greatest (up to date patched version of toplink)
thanks again for your help -
Horizontal mapping not working in Kodo 4.1.2
Hello,
I am having troubles in trying to get the class mapping I want in Kodo 4.1.2.
I want to go from Kodo 3.3 to Kodo 4.1, and still in the evaluation process. Basically, all I want is to have my package.jdo files to work in Kodo 4.1, with the minimum modifications, before moving to JPA.
The mapping is defined is my package.jdo using the <extension vendor-name="kodo" key="jdbc-class-map" value="XXX"/> where XXX can be one of horizontal, base or flat (I dont use vertical in this applicaion). This element does not seem to be properly recognized by the new mapping tool, and all my classes are mapped in the same base table.
After some digging in the docs and in the examples provided, I found this <inheritance strategy="XXX"/> element, that can be put in my package.jdo file. This is not clearly said in the docs (it seems this element is only mentionned in the new orm DTD), but is used in the sample/jdo/horizontal/package.jdo file.
Then I modified my package.jdo files, with this new element, where XXX is one of subclass-table, new-table (with no <join/> nested element) or superclass-table. But the result is not the one expected : all the classes are mapped in the same table.
I then gave a try at the example provided, compiled, enhanced and mapped the sample/jdo/horizontal classes provided with the distribution, since this example covers exactly what I want to do. It seems to me that this example does not work either.
The package.jdo says :
<jdo>
<package name="samples.jdo.horizontal">
<sequence name="sjvm" factory-class="sjvm" strategy="nontransactional"/>
<class name="LastModified">
<inheritance strategy="subclass-table"/>
</class>
The mapping file I get says :
<mapping>
<package name="samples.jdo.horizontal">
<class name="LastModified">
<jdbc-class-map type="base" pk-column="ID" table="LASTMODIFIED"/>
<jdbc-version-ind type="version-number" column="VERSN"/>
<jdbc-class-ind type="in-class-name" column="TYP"/>
<field name="creationDate">
<jdbc-field-map type="value" column="CREATIONDATE"/>
</field>
<field name="lastModificationDate">
<jdbc-field-map type="value" column="LASTMODIFICATIONDATE"/>
</field>
</class>
The enhancement is made using jdoc, the mapping file is generated using the following command line (the DB is empty) :
mappingtool -a refresh -f mapping.xml samples.jdo.horizontal.LastModifiedI would expect an horizontal mapping, with a class element containing only a <jdbc-class-map type="horizontal"/> element, as it is the case if I use my Kodo 3.3 mapping tool.
I tried the enhancement / mapping file generation process with two configuration of the kodo.properties file : the first one with kodo3 as the Mapping Factory and the second with jdo. The result is the same in both cases. I verified by setting the log level to TRACE for the Tool what the factory used. In fact in both case, it is the MappingFileDeprecatedJDOMappingFactory, which seems weird to me.
Bytheway, setting the MappingFactory to jpa leads to the following IllegalArgumentException during enhancement :
Exception in thread "main" org.apache.openjpa.lib.util.ParseException: Instantiation of plugin "MetaDataFactory" with value "jpa" caused an error "java.lang.IllegalArgumentException : java.lang.ClassNotFoundException: jpa". The alias or class name may have been misspelled, or the class may not have be available in the class path. Valid aliases for this plugin are: [jdo, kodo3]
I'd be glad to get any hint if I'm wrong on anything, or any workaround / patch to get my case to work.
Thank you in advance,
JoseIf the same exact app and code works with 4.0 with the same ForeignKeyDeleteAction setting, I suggest that you open a case with support.
This property hasn't changed since 4.0
http://e-docs.bea.com/kodo/docs41/full/html/ref_guide_mapping_defaults.html
Laurent -
Horizontal mapping + MappingInfoNotFoundException
Hi,
i got a problem with the mappingtool.
I'am using horizontal mapping.
The abstract superclass Person has an primary key field called id.
Here is the jdo-metadata from package.jdo:
<class name="Person" identity-type="application"
objectid-class="PersonId">
<field name="location" embedded="true"/>
<field name="id" primary-key="true"/>
<field name="kidNames">
<collection element-type="java.lang.String"/>
</field>
</class>
Here is the mapping data from package.mapping:
<class name="Person">
<jdbc-class-map type="horizontal"/>
</class>
I looked at the manual, section 7.6.4.
Thank you
Zach
688 INFO [main] kodo.Tool - Mapping tool running on type "class
xxx.persistence.jdo.business.Course" with action "validate".
kodo.jdbc.meta.MappingInfoNotFoundException: No mapping information was
found fo
r "xxx.business.Person.id".
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
rovider.java:149)
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
va:429)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:911)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:888)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:666)
at
kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvid
er.java:89)
at
kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
java:364)
at
kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
7)
at
kodo.jdbc.meta.AbstractFieldMapping.getTypeMapping(AbstractFieldMappi
ng.java:661)
at
kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapp
ing.java:123)
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
rovider.java:160)
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
va:429)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:911)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:891)
at
kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.
java:854)
at
kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:617)
at
kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java
:758)
at
kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:323)
at
kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:390)
at
kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
8)
at
kodo.jdbc.meta.AbstractFieldMapping.getTypeMapping(AbstractFieldMappi
ng.java:661)
at
kodo.jdbc.meta.OneToOneFieldMapping.fromMappingInfo(OneToOneFieldMapp
ing.java:123)
at
kodo.jdbc.meta.RuntimeMappingProvider.getFieldMapping(RuntimeMappingP
rovider.java:160)
at
kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.ja
va:429)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:911)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:891)
at
kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapp
ing.java:666)
at
kodo.jdbc.meta.RuntimeMappingProvider.initialize(RuntimeMappingProvid
er.java:89)
at
kodo.jdbc.meta.MappingRepository.getMappingInternal(MappingRepository
java:364)
at
kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:30
7)
at
kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:16
2)
at kodo.jdbc.meta.MappingTool.validate(MappingTool.java:621)
at kodo.jdbc.meta.MappingTool.run(MappingTool.java:939)
at kodo.jdbc.meta.MappingTool.run(MappingTool.java:850)
at kodo.jdbc.meta.MappingTool.main(MappingTool.java:783)
Exception in thread "main"Does Person have any concrete subclasses that map the id field to their
own table? Do other classes have relations to Person? -
Internal Exception: java.lang.NoSuchFieldException
i have a java app that displays data from a table called MasterScrip using jpa. i wish to add an extra field to my table but, when i add an extra field named 'change' to my database table MasterScrip i get following exception, when i remove the field, the app works fine
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions:
Exception [EclipseLink-59] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance variable [change] is not defined in the domain class [entity.MasterScrip], or it is not accessible.
Internal Exception: java.lang.NoSuchFieldException: change
Mapping: org.eclipse.persistence.mappings.DirectToFieldMapping[change-->StockCommodityDB.MasterScrip.Change]
Descriptor: RelationalDescriptor(entity.MasterScrip --> [DatabaseTable(StockCommodityDB.MasterScrip)])
//stack trace with ejbTransactionRolledBackException
entity MasterScrip.java:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package entity;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
* @author root
@Entity
@Table(name = "MasterScrip", catalog = "StockCommodityDB", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "MasterScrip.findAll", query = "SELECT m FROM MasterScrip m"),
@NamedQuery(name = "MasterScrip.findByScripID", query = "SELECT m FROM MasterScrip m WHERE m.scripID = :scripID"),
@NamedQuery(name = "MasterScrip.findByScripSymbol", query = "SELECT m FROM MasterScrip m WHERE m.scripSymbol = :scripSymbol"),
@NamedQuery(name = "MasterScrip.findByType", query = "SELECT m FROM MasterScrip m WHERE m.type = :type"),
@NamedQuery(name = "MasterScrip.findByCompanyName", query = "SELECT m FROM MasterScrip m WHERE m.companyName = :companyName"),
@NamedQuery(name = "MasterScrip.findByLastTradedPrice", query = "SELECT m FROM MasterScrip m WHERE m.lastTradedPrice = :lastTradedPrice"),
@NamedQuery(name = "MasterScrip.findByLastTradedQuantity", query = "SELECT m FROM MasterScrip m WHERE m.lastTradedQuantity = :lastTradedQuantity"),
@NamedQuery(name = "MasterScrip.findByOpenPrice", query = "SELECT m FROM MasterScrip m WHERE m.openPrice = :openPrice"),
@NamedQuery(name = "MasterScrip.findByHighPrice", query = "SELECT m FROM MasterScrip m WHERE m.highPrice = :highPrice"),
@NamedQuery(name = "MasterScrip.findByLowPrice", query = "SELECT m FROM MasterScrip m WHERE m.lowPrice = :lowPrice"),
@NamedQuery(name = "MasterScrip.findByTotalTradedQuantity", query = "SELECT m FROM MasterScrip m WHERE m.totalTradedQuantity = :totalTradedQuantity"),
@NamedQuery(name = "MasterScrip.findByVolume", query = "SELECT m FROM MasterScrip m WHERE m.volume = :volume"),
@NamedQuery(name = "MasterScrip.findByExchange", query = "SELECT m FROM MasterScrip m WHERE m.exchange = :exchange"),
@NamedQuery(name = "MasterScrip.findByBrokerageCharge", query = "SELECT m FROM MasterScrip m WHERE m.brokerageCharge = :brokerageCharge"),
@NamedQuery(name = "MasterScrip.findByPreviousClose", query = "SELECT m FROM MasterScrip m WHERE m.previousClose = :previousClose"),
@NamedQuery(name = "MasterScrip.findByChange", query = "SELECT m FROM MasterScrip m WHERE m.change = :change")})
public class MasterScrip implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = "ScripID", nullable = false)
private Integer scripID;
@Size(max = 15)
@Column(name = "ScripSymbol", length = 15)
private String scripSymbol;
@Size(max = 10)
@Column(name = "Type", length = 10)
private String type;
@Size(max = 50)
@Column(name = "CompanyName", length = 50)
private String companyName;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Column(name = "LastTradedPrice", precision = 22)
private Double lastTradedPrice;
@Column(name = "LastTradedQuantity")
private Integer lastTradedQuantity;
@Column(name = "OpenPrice", precision = 22)
private Double openPrice;
@Column(name = "HighPrice", precision = 22)
private Double highPrice;
@Column(name = "LowPrice", precision = 22)
private Double lowPrice;
@Column(name = "TotalTradedQuantity")
private Integer totalTradedQuantity;
@Column(name = "Volume")
private Integer volume;
@Size(max = 30)
@Column(name = "Exchange", length = 30)
private String exchange;
@Column(name = "BrokerageCharge", precision = 22)
private Double brokerageCharge;
@Column(name = "PreviousClose", precision = 22)
private Double previousClose;
@Column(name = "Change", precision = 22)
private Double change;
@JoinColumn(name = "CommoditySubCategoryID", referencedColumnName = "CommoditySubCategoryID")
@ManyToOne(fetch = FetchType.EAGER)
private CommoditySubCategoryMaster commoditySubCategoryID;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<UserStock> userStockCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<UserTrack> userTrackCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<OrderStock> orderStockCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "scripID", fetch = FetchType.EAGER)
private Collection<TradeStock> tradeStockCollection;
public MasterScrip() {
public MasterScrip(Integer scripID) {
this.scripID = scripID;
public Integer getScripID() {
return scripID;
public void setScripID(Integer scripID) {
this.scripID = scripID;
public String getScripSymbol() {
return scripSymbol;
public void setScripSymbol(String scripSymbol) {
this.scripSymbol = scripSymbol;
public String getType() {
return type;
public void setType(String type) {
this.type = type;
public String getCompanyName() {
return companyName;
public void setCompanyName(String companyName) {
this.companyName = companyName;
public Double getLastTradedPrice() {
return lastTradedPrice;
public void setLastTradedPrice(Double lastTradedPrice) {
this.lastTradedPrice = lastTradedPrice;
public Integer getLastTradedQuantity() {
return lastTradedQuantity;
public void setLastTradedQuantity(Integer lastTradedQuantity) {
this.lastTradedQuantity = lastTradedQuantity;
public Double getOpenPrice() {
return openPrice;
public void setOpenPrice(Double openPrice) {
this.openPrice = openPrice;
public Double getHighPrice() {
return highPrice;
public void setHighPrice(Double highPrice) {
this.highPrice = highPrice;
public Double getLowPrice() {
return lowPrice;
public void setLowPrice(Double lowPrice) {
this.lowPrice = lowPrice;
public Integer getTotalTradedQuantity() {
return totalTradedQuantity;
public void setTotalTradedQuantity(Integer totalTradedQuantity) {
this.totalTradedQuantity = totalTradedQuantity;
public Integer getVolume() {
return volume;
public void setVolume(Integer volume) {
this.volume = volume;
public String getExchange() {
return exchange;
public void setExchange(String exchange) {
this.exchange = exchange;
public Double getBrokerageCharge() {
return brokerageCharge;
public void setBrokerageCharge(Double brokerageCharge) {
this.brokerageCharge = brokerageCharge;
public Double getPreviousClose() {
return previousClose;
public void setPreviousClose(Double previousClose) {
this.previousClose = previousClose;
public Double getChange() {
return change;
public void setChange(Double change) {
this.change = change;
public CommoditySubCategoryMaster getCommoditySubCategoryID() {
return commoditySubCategoryID;
public void setCommoditySubCategoryID(CommoditySubCategoryMaster commoditySubCategoryID) {
this.commoditySubCategoryID = commoditySubCategoryID;
@XmlTransient
public Collection<UserStock> getUserStockCollection() {
return userStockCollection;
public void setUserStockCollection(Collection<UserStock> userStockCollection) {
this.userStockCollection = userStockCollection;
@XmlTransient
public Collection<UserTrack> getUserTrackCollection() {
return userTrackCollection;
public void setUserTrackCollection(Collection<UserTrack> userTrackCollection) {
this.userTrackCollection = userTrackCollection;
@XmlTransient
public Collection<OrderStock> getOrderStockCollection() {
return orderStockCollection;
public void setOrderStockCollection(Collection<OrderStock> orderStockCollection) {
this.orderStockCollection = orderStockCollection;
@XmlTransient
public Collection<TradeStock> getTradeStockCollection() {
return tradeStockCollection;
public void setTradeStockCollection(Collection<TradeStock> tradeStockCollection) {
this.tradeStockCollection = tradeStockCollection;
@Override
public int hashCode() {
int hash = 0;
hash += (scripID != null ? scripID.hashCode() : 0);
return hash;
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof MasterScrip)) {
return false;
MasterScrip other = (MasterScrip) object;
if ((this.scripID == null && other.scripID != null) || (this.scripID != null && !this.scripID.equals(other.scripID))) {
return false;
return true;
@Override
public String toString() {
return "entity.MasterScrip[ scripID=" + scripID + " ]";
what could be the reason of this exception? how do i solve it?i cleaned and built the app and redeployed it. now i am getting the following exception:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Change, CompanyName, Exchange, HighPrice, LastTradedPrice, LastTradedQuantity, L' at line 1
Error Code: 1064
Call: SELECT ScripID, BrokerageCharge, Change, CompanyName, Exchange, HighPrice, LastTradedPrice, LastTradedQuantity, LowPrice, OpenPrice, PreviousClose, ScripSymbol, TotalTradedQuantity, Type, Volume, CommoditySubCategoryID FROM StockCommodityDB.MasterScrip
Query: ReadAllQuery(name="MasterScrip.findAll" referenceClass=MasterScrip sql="SELECT ScripID, BrokerageCharge, Change, CompanyName, Exchange, HighPrice, LastTradedPrice, LastTradedQuantity, LowPrice, OpenPrice, PreviousClose, ScripSymbol, TotalTradedQuantity, Type, Volume, CommoditySubCategoryID FROM StockCommodityDB.MasterScrip")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
where am i wrong? -
Need help ASAP : Exception with EJB 3.0 while session.xml
Hi,
Kindly help on below exception, which i am getting the exception while changing the mine EJB 2.1 to 3.0.
Exception raised while loading the session.xml, which is reffering to map file which is used by Toplink.
**Mine EJB:**
public class CaseSessionEJBBean implements CaseSessionEJB {
String inBean="[CaseSessionEJBBean] ";
private SessionFactory sessionFactory;
public CaseSessionEJBBean() {
this.sessionFactory =new SessionFactory("META-INF/sessions.xml", "moj");
*private SessionFactory getSessionFactory() {*
return this.sessionFactory;
*}* public PagedResultList<CasedetailsDTO> searchPayment(SearchCriteriaDTO searchCriteriaDTO,Integer startIndex,Integer endIndex) throws MOJException{
String inMethod="[searchPayment] ";
PagedResultList pagedCaseDetailsDTOList=null;
try{
System.out.println("[CaseSessionEJBBean] !!!! ENTERED !!!!!");
Session session = getSessionFactory().acquireSession();
CaseFacade caseFacade = new CaseFacade();
pagedCaseDetailsDTOList=caseFacade.searchPayment(session, searchCriteriaDTO,startIndex,endIndex);
System.out.println("pagedCaseDetailsDTOList.size()="+pagedCaseDetailsDTOList.size());
}catch(Exception e){
e.printStackTrace();
System.out.println("[Exception] While getting payment details:"+e);
throw new MOJException("1001", e.getMessage(),
"Exception occured",
"Exception in searchPayment()",
"searchPayment", "CaseSessionEJBBean",
"searchPayment", e);
return pagedCaseDetailsDTOList;
Exception:
Exception Description: Several [1] SessionLoaderExceptions were thrown:
Exception [TOPLINK-9005] (Oracle TopLink - 10g Release 3 (10.1.3.3.0) (Build 070608)): oracle.toplink.exceptions.SessionLoaderException
Exception Description: *An exception was thrown while loading the <project-xml> file [META-INF/MOJMap.xml].*
Internal Exception: oracle.classloader.util.AnnotatedLinkageError: duplicate class definition: oracle/toplink/indirection/IndirectList
Invalid class: oracle.toplink.indirection.IndirectList
Loader: current-workspace-app.root:0.0.0
Code-Source: /D:/MOJ_SVN/Lib/toplink.jar
Configuration: <library> in /D:/Temp/MOJ_EJB_3.0/CMS-oc4j-app.xml
Dependent class: oracle.toplink.internal.helper.ConversionManager
Loader: oracle.toplink:10.1.3
Code-Source: /D:/jdevstudio/toplink/jlib/toplink.jar
Configuration: <code-source> (ignore manifest Class-Path) in META-INF/boot.xml in D:\jdevstudio\j2ee\home\oc4j.jar
The original class instance was also defined in oracle.toplink:10.1.3.
Thanks in Advance:
Need in urgent
Edited by: user636100 on Feb 6, 2009 7:44 AMYou have two copies of toplink.jar visible to the application classloader - D:/MOJ_SVN/Lib/toplink.jar should be removed.
For compilation of the application use toplink.jar provided by the server: D:/jdevstudio/toplink/jlib/toplink.jar -
How to convert xml file into internal table in ABAP Mapping.
Hi All,
I am trying with ABAP mapping. I have one scenario in which I'm using below xml file as a sender from my FTP server.
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MTO_ABAP_MAPPING xmlns:ns0="http://Capgemini/Mumbai/sarsingh">
<BookingCode>2KY34R</BookingCode>
- <Passenger>
<Name>SARVESH</Name>
<Address>THANE</Address>
</Passenger>
- <Passenger>
<Name>RAJESH</Name>
<Address>POWAI</Address>
</Passenger>
- <Passenger>
<Name>CARRON</Name>
<Address>JUHU</Address>
</Passenger>
- <Flight>
<Date>03/03/07</Date>
<AirlineID>UA</AirlineID>
<FlightNumber>125</FlightNumber>
<From>LAS</From>
<To>SFO</To>
</Flight>
</ns0:MTO_ABAP_MAPPING>
AT the receiver side I wnat to concatenate the NAME & ADDRESS.
I tried Robert Eijpe's weblog (/people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach)
but couldnt succeed to convert the xml file into internal table perfectly.
Can anybody help on this.
Thanks in advance!!
SarveshHi Sarvesh,
The pdf has details of ABAP mapping. The example given almost matches the xml file you want to be converted.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/how to use abap-mapping in xi 3.0.pdf
Just in case you have not seen this
regards
Vijaya -
Excel data transfer into SAP internal table with GUI_UPLOAD
hi all,
i m using SRM4 system and i wanted to develop one report which will upload data from excel and convert it into IT.
i know that many threads are posted on this topic.
but my requirement is slight different. in the system only one function module is available that is "GUI_UPLOAD" and we want that user shd not save file as tab delimited before calling this fm. instead, program shd take care of all these things...
please suggest something asap..
helpful ans will be rewarded..
thanks,
jigs.Dear Jigs,
Please go though the following lines of code:
D A T A D E C L A R A T I O N *
TABLES: ANEP,
BKPF.
TYPES: BEGIN OF TY_TABDATA,
MANDT LIKE SY-MANDT, " Client
ZSLNUM LIKE ZSHIFTDEPN-ZSLNUM, " Serial Number
ZASSET LIKE ZSHIFTDEPN-ZASSET, " Original asset that was transferred
ZYEAR LIKE ZSHIFTDEPN-ZYEAR, " Fiscal Year
ZPERIOD LIKE ZSHIFTDEPN-ZPERIOD, " Fiscal Period
ZSHIFT1 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 1
ZSHIFT2 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 2
ZSHIFT3 LIKE ZSHIFTDEPN-ZSHIFT1, " Shift No. 3
END OF TY_TABDATA.
Declaration of the Internal Table with Header Line comprising of the uploaded data.
DATA: BEGIN OF IT_FILE_UPLOAD OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
DATA: END OF IT_FILE_UPLOAD.
S E L E C T I O N - S C R E E N *
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME,
BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS: P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK B2,
END OF BLOCK B1.
E V E N T : AT S E L E C T I O N - S C R E E N *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = '.'
CHANGING
FILE_NAME = P_FNAME
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
E V E N T : S T A R T - O F - S E L E C T I O N *
START-OF-SELECTION.
Upload Excel file into Internal Table.
PERFORM UPLOAD_EXCEL_FILE.
Organize the uploaded data into another Internal Table.
PERFORM ORGANIZE_UPLOADED_DATA.
E V E N T : E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
*& Form UPLOAD_EXCEL_FILE
text
--> p1 text
<-- p2 text
FORM UPLOAD_EXCEL_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_FNAME
I_BEGIN_COL = 1
I_BEGIN_ROW = 3
I_END_COL = 7
I_END_ROW = 32000
TABLES
INTERN = IT_FILE_UPLOAD
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " UPLOAD_EXCEL_FILE
*& Form ORGANIZE_UPLOADED_DATA
text
--> p1 text
<-- p2 text
FORM ORGANIZE_UPLOADED_DATA .
SORT IT_FILE_UPLOAD BY ROW
COL.
LOOP AT IT_FILE_UPLOAD.
CASE IT_FILE_UPLOAD-COL.
WHEN 1.
WA_TABDATA-ZSLNUM = IT_FILE_UPLOAD-VALUE.
WHEN 2.
WA_TABDATA-ZASSET = IT_FILE_UPLOAD-VALUE.
WHEN 3.
WA_TABDATA-ZYEAR = IT_FILE_UPLOAD-VALUE.
WHEN 4.
WA_TABDATA-ZPERIOD = IT_FILE_UPLOAD-VALUE.
WHEN 5.
WA_TABDATA-ZSHIFT1 = IT_FILE_UPLOAD-VALUE.
WHEN 6.
WA_TABDATA-ZSHIFT2 = IT_FILE_UPLOAD-VALUE.
WHEN 7.
WA_TABDATA-ZSHIFT3 = IT_FILE_UPLOAD-VALUE.
ENDCASE.
AT END OF ROW.
WA_TABDATA-MANDT = SY-MANDT.
APPEND WA_TABDATA TO IT_TABDATA.
CLEAR: WA_TABDATA.
ENDAT.
ENDLOOP.
ENDFORM. " ORGANIZE_UPLOADED_DATA
In the subroutine --> ORGANIZE_UPLOADED_DATA, data are organized as per the structure declared above.
Regards,
Abir
Don't forget to award points * -
Raising Exceptions in XSLT mapping.?
Hi,
When there is an mapping exception, in UDF, i raise an exception...
Similar is the case with Java & ABAP mappings.
Now, How do i raise mapping exceptions in XSLT mapping (Java & ABAP)..?
--DJYou could use Java enhancement, but instead of just adding info to the trace, you could raise a real exception, using an ErrorHandler object. Ive successfully worked with the one below (not with XSLTs, tho, but I dont see why it shouldnt work.
import java.util.Map;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformationConstants;
* @author Henrique.Pinto
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
public class MappingErrorHandler implements ErrorHandler {
private static AbstractTrace trace = null;
public MappingErrorHandler(Map param) {
trace =
(AbstractTrace) param.get(
StreamTransformationConstants.MAPPING_TRACE);
public void warning(SAXParseException exception) throws SAXException {
trace.addInfo(
"**Parsing Warning**n"
+ " Line: "
+ exception.getLineNumber()
+ "n"
+ " URI: "
+ exception.getSystemId()
+ "n"
+ " Message: "
+ exception.getMessage());
throw new SAXException("Warning encountered");
public void error(SAXParseException exception) throws SAXException {
trace.addInfo(
"**Parsing Error**n"
+ " Line: "
+ exception.getLineNumber()
+ "n"
+ " URI: "
+ exception.getSystemId()
+ "n"
+ " Message: "
+ exception.getMessage());
throw new SAXException("Error encountered");
public void fatalError(SAXParseException exception) throws SAXException {
trace.addInfo(
"**Parsing Fatal Error**n"
+ " Line: "
+ exception.getLineNumber()
+ "n"
+ " URI: "
+ exception.getSystemId()
+ "n"
+ " Message: "
+ exception.getMessage());
throw new SAXException("Fatal Error encountered");
Regards,
Henrique. -
XSLT-Mapping Exception: Prefix not mapped:
Hi all,
I try to make a mapping using XSLT and get the exception: Prefix not mapped: ns0.
I wrote a simple xslt-script:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://me.home.com">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="//XIFCollection">
<Start>
<xsl:for-each select="ns1:XIFTest">
<Found>
<xsl:number format="1"/>
</Found>
</xsl:for-each>
</Start>
</xsl:template>
</xsl:stylesheet>
Using this input XML:
<?xml version="1.0" encoding="UTF-8"?>
<XIFCollection >
<ns0:XIFTest xmlns:ns0="http://me.home.com">
<IFControl>
<MeldungsId>1</MeldungsId>
</IFControl>
<XTest>
</XTest>
</ns0:XIFTest>
<ns0:XIFTest xmlns:ns0="http://me.home.com">
<IFControl>
<MeldungsId>2</MeldungsId>
</IFControl>
<XTest>
</XTest>
</ns0:XIFTest>
</XIFCollection>
In XML-Spy I get the following output:
<?xml version="1.0" encoding="UTF-8"?>
<Start xmlns:ns1="http://me.home.com">
<Found>1</Found>
<Found>2</Found>
</Start>
What I expected.
But using XI or the XML-Toolkit XI30xslt I get the exception:
java.lang.Exception: XMLParser: Prefix 'ns0' is not mapped to a namespace.
I tried everything and searched all dokumentation but have no idea.
Anyone with an idea?
ThanksHi,
you need to chage as Udo said
but also the other ns0 one:
check this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://me.home.com">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="//XIFCollection">
<Start>
<xsl:for-each select="ns0:XIFTest">
<Found>
<xsl:number format="1"/>
</Found>
</xsl:for-each>
</Start>
</xsl:template>
</xsl:stylesheet>
BTW
it works in Stylus Studio now
Regards,
michal -
Question about Logon ticket with user mapping at BI-JAVA environment
We're implementing BI 7.0 including BI Java and SAP EP for end user
access.
I have two question about SSO method when we're using BI Java.
I know we can simply configure SSO logon ticket with BI-Java(EP
included) and BI-ABAP through BI template installer and we already
succeeded in that case.
But the problem is we want to change it to user mapping SSO method for
some our internal reason.
After we configure user mapping SSO, we've got SSO failed error when we
call BI-Java stuff like BEx Web Application iView.
After many testing implemented, we found SSO Logon ticket with user
mapping (using SAP reference system). It seems working now.
But our question is "Is it no problem when we use SSO logon ticket with
user mapping?" Is there any restriction or issue?
One more question is we can ONLY use user base mapping when reference
system used. How can we assign BI-ABAP users to EP Group?Using an SAP Reference system is allright. But if the reason u r going for this is because of different usernames in EP and BI, why dont you go for user mapping.
Anyways, on restriction of reference syetms is that you can have ONLY ONE reference system defined in portal. In you case you can only have the BI system defined.
Hope this helps!! -
Hello experts,
I developed a Java Mapping Programm for reading filename of a pdf file and giving filename to a rfc structure for calling a rfc module. Thus, I test it via testing interface method and implementing a main method in my mapping class, which works, but if I run it in the integration server I get the following exception:
MP: Exception caused of com.sap.aii.af.ra.ms.api.RecoverableException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7: com.sap.aii.af.rfc.afcommunication.RfcAFWException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7
That is the execute method of my class:
public void execute(InputStream inputStream, OutputStream outputStream)
throws StreamTransformationException {
// TODO Auto-generated method stub
try { //The following is for the FileName in the File Adapter
DynamicConfiguration dynamicconfiguration =
(DynamicConfiguration) map.get("DynamicConfiguration");
DynamicConfigurationKey key =
DynamicConfigurationKey.create(
"http://sap.com/xi/XI/System/File",
"FileName");
String myFileName = dynamicconfiguration.get(key);
MappingTrace trace = null;
trace.addInfo(myFileName);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
Document docout = db.newDocument();
Element root = docout.createElement("Z_SD_WEB_HP_INVOICE_STATUS");
root.setAttribute(
"xmlns:ns1",
"urn:sap-com:document:sap:rfc:functions");
docout.appendChild(root);
Element docName = docout.createElement("IM_DOCNAME");
root.appendChild(docName);
Text srcxml = docout.createTextNode(myFileName);
docName.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(outputStream));
} catch (Throwable throwable) {
throwable.printStackTrace();
If I test via main method and testing interface mapping the generated xml is like:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Z_SD_WEB_HP_INVOICE_STATUS xmlns:ns1="urn:sap-com:document:sap:rfc:functions"><IM_DOCNAME>232132.pdf</IM_DOCNAME></Z_SD_WEB_HP_INVOICE_STATUS>
I do not understand why I get this error in real environment.
Kind regards,
ErkanHello experts,
I found the solution. I will also publish this solution, this is also a point which I sometimes missing here in this forum:
In creating the rfc-xml with java mapping, so a prefix should be add to the name of the rfc-structure e.g.
ns1:Z_RFC_CALL. If this prefix is missing, then you get this error:
com.sap.aii.af.ra.ms.api.RecoverableException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7: com.sap.aii.af.rfc.afcommunication.RfcAFWException: java.lang.StringIndexOutOfBoundsException: String index out of range: -7
To find this I create a grafical test mapping and I check the test rfc-xml with the java created xml.
Anyway thanks all for the published recommendations.
Kind regards,
Erkan
Maybe you are looking for
-
10.5 will not connect to iPod Touch - Spinning beachball
iTunes 10.5 will not connect to my iPod touch (I had no problems with the previous version). Now all I get is a spinning beach ball and iTunes locks up.
-
How to gray out certain fields on the selection screen based on the radio b
HI All, I have an ALV report. On the selection screen I have 2 radio buttons ..for eg..A and B. When radio button A(its on by default) is on..certain fields not relevant to this should be grayed out. Similarly when radio button B is on, certain fie
-
Uccx demo license disappears after reboot
hi. im trying to install uccx 8.5 in vmware for lab purposes. when i install the demo license included in the DVD, it works out fine. however when i reload the VM and try to log back to uccx, it says that there is no license installed. when i try to
-
How to Add a Checkbox to a databeans.RowSetBrowser
Hello, I was wondering if anyone knows if you can a checkbox to the Data Web Bean Rowset Browser. I would like to have a checkbox associated with each row that is displayed in the rowset browser. Please let me know if this is possible, and if so any
-
Dual 1.8 G5 Losing Processor Since Leopard
I have a Dual 1.8 G5 (2003) that I recently loaded Leopard on. A few times since I've loaded Leopard I've had the second processor disappear. MenuMeters and Activity Monitor will show the CPU at 0% regardless of load, and when I check the System Prof