Kodo 4.0.0EA3 JDOHelper.is...() state functions
I'm trying to write unit tests for some of my higher level classes, and I've run into trouble trying
to test functions that delete persistent objects. I'm using Spring Framework's
AbstractTransactionalSpringContextTests class as my harness (which derives from JUnit's TestCase).
It sets up a transaction before each test function and rolls the transaction back (by default, this
is editable) after each test function. Because of this, I decided to base the test on the results of
JDOHelper.isDelete( objectThatWasDeleted ). My tests fail though, and all of the JDOHelper.is...()
functions return false at all points during the test. I know things are getting deleted though,
because before the Spring created transaction is started, I create my own transaction and persist
some objects, and after the Spring transaction is finished (and the test case), I create another
transaction to remove them (both my transactions are committed). Even in the tear down function,
JDOHelper.is...() functions don't seem to work; for example, isDeleted() returns false even though
the object has been scheduled for deletion and is in fact deleted when the transaction commits.
Is this a known bug? I was under the impression that JDOHelper functions were working as of EA2 (I
know they weren't working before that and we had to use KodoHelper).
Thanks,
Mark
Here's the code in question:
* This function is called after the test and the transaction it ran in have been completed.
* By default, the transaction is rolled back, but this can be overridden. This function
* should ensure the tests have been cleaned up, including anything that was created by the
* companion function onSetUpBeforeTransaction().
* @see onSetUpBeforeTransaction()
protected void onTearDownAfterTransaction()
if( transactionManager != null )
getLogger().info( "Starting transaction for post-test tear down." );
TransactionStatus status =
transactionManager.getTransaction( new DefaultTransactionDefinition() );
if( status != null )
getLogger().info( "Transaction for post-test tear down has been created." );
UserManager userManager = (UserManager) applicationContext.getBean( "userManager" );
User userToAlter = userManager.getUser( USER_TO_ALTER_USERNAME );
userManager.removeUser( userToAlter );
getLogger().debug(
"userToAlter (Kodo) - isDirty = " + KodoJDOHelper.isDirty( userToAlter )
+ ", isNew = " + KodoJDOHelper.isNew( userToAlter )
+ ", isPersistent = " + KodoJDOHelper.isPersistent( userToAlter )
+ ", isDeleted = " + KodoJDOHelper.isDeleted( userToAlter ) );
getLogger().debug( "userToAlter - isDirty = " + JDOHelper.isDirty( userToAlter )
+ ", isNew = " + JDOHelper.isNew( userToAlter )
+ ", isPersistent = " + JDOHelper.isPersistent( userToAlter )
+ ", isDeleted = " + JDOHelper.isDeleted( userToAlter ) );
try
transactionManager.commit( status );
finally
status = null;
else
getLogger().info( "Could not create transaction for post-test tear down."
+ " Superclass' transactionManager is null." );
And here's the log output (I've put blank lines around the relevant output):
2005-11-10 12:50:17,669 INFO [edu.ucsc.whisper.test.integration.UserManagerIntegrationTest] -
<Rolled back transaction after test execution>
2005-11-10 12:50:17,669 INFO [edu.ucsc.whisper.test.integration.UserManagerIntegrationTest] -
<Starting transaction for post-test tear down.>
2005-11-10 12:50:17,670 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Using
transaction object [org.springframework.orm.jdo.JdoTransactionManager$JdoTransactionObject@82d44b]>
2005-11-10 12:50:17,670 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Creating new
transaction with name [null]>
2005-11-10 12:50:17,670 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Opened new
PersistenceManager [kodo.jdo.PersistenceManagerImpl@3faa8d] for JDO transaction>
2005-11-10 12:50:17,670 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Exposing JDO
transaction as JDBC transaction
[org.springframework.orm.jdo.DefaultJdoDialect$DataStoreConnectionHandle@285701]>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Bound value
[org.springframework.jdbc.datasource.ConnectionHolder@681dea] for key [datasource 9833630] to thread
[main]>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Bound value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] to thread [main]>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Initializing
transaction synchronization>
2005-11-10 12:50:17,671 INFO [edu.ucsc.whisper.test.integration.UserManagerIntegrationTest] -
<Transaction for post-test tear down has been created.>
2005-11-10 12:50:17,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory]
- <Returning cached instance of singleton bean 'userManager'>
2005-11-10 12:50:17,671 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory]
- <Bean with name 'userManager' is a factory bean>
2005-11-10 12:50:17,671 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Getting transaction for edu.ucsc.whisper.core.UserManager.getUser>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] bound to thread [main]>
2005-11-10 12:50:17,671 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Found
thread-bound PersistenceManager [kodo.jdo.PersistenceManagerImpl@3faa8d] for JDO transaction>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.jdbc.datasource.ConnectionHolder@681dea] for key [datasource 9833630] bound to
thread [main]>
2005-11-10 12:50:17,671 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Using
transaction object [org.springframework.orm.jdo.JdoTransactionManager$JdoTransactionObject@87f48e]>
2005-11-10 12:50:17,671 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Participating
in existing transaction>
2005-11-10 12:50:17,671 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] bound to thread [main]>
2005-11-10 12:50:17,672 DEBUG [kodo.Query] - <executing query: [SELECT UNIQUE FROM
edu.ucsc.whisper.core.DefaultUser WHERE username==searchName
PARAMETERS java.lang.String searchName] with parameters: {searchName=userToAlter}>
2005-11-10 12:50:17,674 DEBUG [kodo.jdbc.JDBC] - <<t 977184> connection pool: active=0, idle=1>
2005-11-10 12:50:17,674 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> checkout>
2005-11-10 12:50:17,674 DEBUG [kodo.jdbc.JDBC] - <<t 977184> prepared statement cache: size=8,
max=50, requests=12, hits=4, created=8, redundant=0, overflow=0, leaked=0>
2005-11-10 12:50:17,677 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [3 ms] executing prepstmnt
1168959 SELECT t0.userId, t0.VERSN, t0.enabled, t0.password, t1.userInfoId, t1.VERSN, t1.aboutText,
t1.familyName, t1.firstName, t1.gender, t1.namePrefix, t1.nameSuffix, t1.otherNames, t2.userId,
t2.VERSN, t2.enabled, t2.password, t2.USERINFO, t2.username, t0.username FROM whisper_user t0 LEFT
OUTER JOIN userinfo t1 ON t0.USERINFO = t1.userInfoId LEFT OUTER JOIN whisper_user t2 ON
t1.userInfoId = t2.USERINFO WHERE (t0.username = ?) [params=(String) userToAlter] [reused=1]>
2005-11-10 12:50:17,690 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [3 ms] executing prepstmnt
4297359 SELECT t0.previousName, t0.nameOrder FROM userInfo_PreviousNames t0 WHERE t0.userInfoId = ?
ORDER BY t0.nameOrder ASC [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,693 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [2 ms] executing prepstmnt
16585718 SELECT t1.authorityId, t1.VERSN, t1.authority FROM user_authorities t0 INNER JOIN
authorities t1 ON t0.authorityId = t1.authorityId WHERE t0.userId = ? [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,697 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [3 ms] executing prepstmnt
11277980 SELECT t0.organizationId, t0.VERSN, t0.city, t0.country, t0.isPrimary, t0.orgName,
t0.positionTitle, t0.postalCode, t0.state, t0.streetAddress1, t0.streetAddress2, t0.streetAddress3,
t0.userId FROM organization t0 WHERE t0.userId = ? [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,698 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> return>
2005-11-10 12:50:17,698 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> [0 ms] close>
2005-11-10 12:50:17,698 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Invoking commit for transaction on edu.ucsc.whisper.core.UserManager.getUser>
2005-11-10 12:50:17,698 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Getting transaction for edu.ucsc.whisper.core.UserManager.removeUser>
2005-11-10 12:50:17,698 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] bound to thread [main]>
2005-11-10 12:50:17,698 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Found
thread-bound PersistenceManager [kodo.jdo.PersistenceManagerImpl@3faa8d] for JDO transaction>
2005-11-10 12:50:17,698 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.jdbc.datasource.ConnectionHolder@681dea] for key [datasource 9833630] bound to
thread [main]>
2005-11-10 12:50:17,698 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Using
transaction object [org.springframework.orm.jdo.JdoTransactionManager$JdoTransactionObject@ba0b12]>
2005-11-10 12:50:17,699 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Participating
in existing transaction>
2005-11-10 12:50:17,700 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] bound to thread [main]>
2005-11-10 12:50:17,702 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] bound to thread [main]>
2005-11-10 12:50:17,702 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Invoking commit for transaction on edu.ucsc.whisper.core.UserManager.removeUser>
2005-11-10 12:50:17,702 DEBUG [edu.ucsc.whisper.test.integration.UserManagerIntegrationTest] -
<userToAlter (Kodo) - isDirty = false, isNew = false, isPersistent = false, isDeleted = false>
2005-11-10 12:50:17,702 DEBUG [edu.ucsc.whisper.test.integration.UserManagerIntegrationTest] -
<userToAlter - isDirty = false, isNew = false, isPersistent = false, isDeleted = false>
2005-11-10 12:50:17,703 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Triggering
beforeCommit synchronization>
2005-11-10 12:50:17,703 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Triggering
beforeCompletion synchronization>
2005-11-10 12:50:17,703 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Initiating
transaction commit>
2005-11-10 12:50:17,703 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Committing JDO
transaction on PersistenceManager [kodo.jdo.PersistenceManagerImpl@3faa8d]>
2005-11-10 12:50:17,703 DEBUG [kodo.jdbc.JDBC] - <<t 977184> connection pool: active=0, idle=1>
2005-11-10 12:50:17,703 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> checkout>
2005-11-10 12:50:17,703 DEBUG [kodo.jdbc.JDBC] - <<t 977184> prepared statement cache: size=11,
max=50, requests=16, hits=5, created=11, redundant=0, overflow=0, leaked=0>
2005-11-10 12:50:17,705 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [1 ms] executing prepstmnt
1104991 DELETE FROM userInfo_PreviousNames WHERE userInfoId = ? [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,706 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [1 ms] executing prepstmnt
15986263 DELETE FROM user_authorities WHERE authorityId = ? [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,708 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [1 ms] executing prepstmnt
10794796 DELETE FROM user_authorities WHERE userId = ? [params=(long) 1] [reused=0]>
2005-11-10 12:50:17,710 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [2 ms] executing prepstmnt
16100636 DELETE FROM authorities WHERE authorityId = ? AND VERSN = ? [params=(long) 1, (int) 1]
[reused=0]>
2005-11-10 12:50:17,711 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [1 ms] executing prepstmnt
3677634 DELETE FROM userinfo WHERE userInfoId = ? AND VERSN = ? [params=(long) 1, (int) 1] [reused=0]>
2005-11-10 12:50:17,713 DEBUG [kodo.jdbc.SQL] - <<t 977184, conn 3700728> [1 ms] executing prepstmnt
2745891 DELETE FROM whisper_user WHERE userId = ? AND VERSN = ? [params=(long) 1, (int) 1] [reused=0]>
2005-11-10 12:50:17,828 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> [115 ms] commit>
2005-11-10 12:50:17,829 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> return>
2005-11-10 12:50:17,829 DEBUG [kodo.jdbc.JDBC] - <<t 977184, conn 3700728> [1 ms] close>
2005-11-10 12:50:17,830 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Triggering
afterCompletion synchronization>
2005-11-10 12:50:17,830 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Clearing transaction
synchronization>
2005-11-10 12:50:17,830 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Removed value
[org.springframework.orm.jdo.PersistenceManagerHolder@8424bd] for key
[kodo.jdo.PersistenceManagerFactoryImpl@aa994e] from thread [main]>
2005-11-10 12:50:17,830 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Removed value
[org.springframework.jdbc.datasource.ConnectionHolder@681dea] for key [datasource 9833630] from
thread [main]>
2005-11-10 12:50:17,831 DEBUG [org.springframework.orm.jdo.JdoTransactionManager] - <Closing JDO
PersistenceManager [kodo.jdo.PersistenceManagerImpl@3faa8d] after transaction>
2005-11-10 12:50:17,831 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Closing JDO PersistenceManager>
Abe White wrote:
You need to make sure that when you enhance, you include JDO
enhancement, not just the base Kodo enhancement. Now that Kodo 4
supports EJB 3 users who might not want JDO, it doesn't enhance-in
dependencies on JDO unless you ask it to.
If you enhance on the command line, that means using the "jdoc" command
rather than "kodoc" ("jdoc" is actually just a shortcut for "kodoc -jdo
true"). If you use the PCEnhancerTask, it means setting the jdoEnhance
attribute:
<taskdef name="kodoc" classname="kodo.ant.PCEnhancer"/>
<kodoc jdoEnhance="true">
</kodoc>So, what are the primary differences between the enhancement done for EJB3
and JDO? I gather that "base Kodo enhancement" is EJB3.
Scott
Similar Messages
-
How does BerkeleyDB know when cached results from stat function are valid ?
Something curious: I have a berkeley database about 2G in size and a program that (1) opens the database, not DB_RDONLY; (2) calls stat(), without DB_FAST_STAT; (3) calls sync(); (4) calls close().
Running this program the first time takes a good amount of time in the stat() function - 20 minutes at least - and thrashes the disk all that time. So it's trawling the database to get record counts etc.
Running the program again takes only a few seconds so clearly the database is caching those stats and knows they're up to date - makes sense.
What's odd though is why the stats weren't known to be up to date on the first run. The database was actually copied from another box where the last thing to happen was a run of the same program. So it should have had up-to-date stats cached in it.
It's as if the cached values are somehow invalidated by moving the database to another machine. Why would that happen ? Where are the cached stats held and how does berekelyDB decide when they're up to date ?I still cannot solve this problem, but I have some more observations:
1) yes it is a JApplet, and yes, the data streaming is performed in a separate thread.
2) Wireshark sniffing shows that data sent out by the PHP datasource on the server is sent immediately, and is not buffered (am using ob_start(), ob_flush() and flush() alls in the PHP script).
3) On Windows Vista, using Internet Explorer or Firefox, there is a constant 30 second delay before the Applet returns from this line: InputStream is = url.openStream();
4) After this 30 seconds, data appears in the Applet, but it can be seen also with java console debug prints that the data seems to be buffered. The newest data shown in the Applet is not the newest data sent to the client by the PHP datasource script.
5) On a SUSE Linux client, the Applet works as it should, there is no delay time in showing the data.
It appears as if there is on Windows a buffering of data which I do not wish to have and which does not occur on Linux. I need to find out how to get the URL openStream() call to return immediately allowing the initial data to be read and shown on the Applet. And I need to remove the buffering of data so that the data can be shown on the Applet when it arrives.
Can anyone help? Why does this work on Linux but not on Windows, and what can I do, at best within the Java code, to get the Applet to work on Windows as it does on Linux?
Thanks!
Steve, Denmark -
Query regarding Concatenate statement functionality from ECC 6.0 to 46B ver
Hi,
I got new requirement ie I have to copy reports from ECC6.0 to 46B version. While copying I faced number of issues and I am not clear for below one.
concatenate i_result1-result p_delim into i_result1-result respecting blanks. ( this is in ECC6.0)
now my requirement is I have to use the same functionality in 46B version without respecting blanks the statement is working but I need the functinality of respecting blanks also.
Thanks in advance.
-Kumar.Try like this in 46B:
concatenate i_result1-result p_delim into i_result1-result SEPARATED BY SPACE.
Regards,
Naimesh Patel -
BUPA_MAIN stays in Intermediate state Function Module missing
We noticed that on our Productive system, since yesterday most
of the BUPA_MAIN BDOCs status are in yellow "After qRFC step (intermediate
state)" since last two days on PRM. Before it was working fine.
We got o SMW01 & re-process it, then we get a short dump which says:
" Function module "/1CRMGC/CGBUPA_MAIN_RRR" not found."
We compared in th eTxn: SBDM the BUPA_MAIN on Production & Test systems.
We found that the Module "/1CRMGC/CGBUPA_MAIN_RRR" is not there in Production but it
is there on other systems where its working.
Please let us know how we can generate this,
Is it the normal process to Generate on the dsired system in our case production directly? or do we do it in Development & then Transport it.
We have this bug in Production and fix this asap.
Thanks
Regards
Rahul
Edited by: Rahul Kumar Lal on Sep 2, 2010 1:50 PMHi Rahul,
Goto Trxn. GNRWB -
Generator Group : REPLI
Industry : Consumer Goods
Select BUPA_MAIN on L.H.S. and all Generators on the R.H.S.
Click on Generate/Check icons.
or you can goto trxn . SMOGGEN and select BUPA_MAIN.
Tnx,
Rohit -
Kodo 4.0.0EA3 Available
All,
Kodo 4.0.0 EA 3 is now available. Kodo 4 implements the JDO 2 and EJB 3
Persistence specifications. Feel free to download it at:
http://www.solarmetric.com/Software/beta/4.0.0EA/
You can find the release notes at:
http://solarmetric.com/Software/Documentation/4.0.0EA3/docs/full/html/relnotes.html
The full documentation can be found in the distribution, and also at:
http://solarmetric.com/Software/Documentation/4.0.0EA3/docs/full/html/index.
html
Please report any issues that you find to the Kodo beta newsgroup
(solarmetric.kodo.beta).
Good luck, and enjoy!
-Greg
SolarMetric
www.solarmetric.comAbe White wrote:
You need to make sure that when you enhance, you include JDO
enhancement, not just the base Kodo enhancement. Now that Kodo 4
supports EJB 3 users who might not want JDO, it doesn't enhance-in
dependencies on JDO unless you ask it to.
If you enhance on the command line, that means using the "jdoc" command
rather than "kodoc" ("jdoc" is actually just a shortcut for "kodoc -jdo
true"). If you use the PCEnhancerTask, it means setting the jdoEnhance
attribute:
<taskdef name="kodoc" classname="kodo.ant.PCEnhancer"/>
<kodoc jdoEnhance="true">
</kodoc>So, what are the primary differences between the enhancement done for EJB3
and JDO? I gather that "base Kodo enhancement" is EJB3.
Scott -
Kodo 3.0 generates invalid SQL statement when deleting an instance
Hi,
kodo 3.0 generates an invalid SQL statement when deleting an instance
that has a one-many inverse unidirectional association.
All manipulations of the data go just fine except for the deletion of
instances of Whole without Parts. Kodo 3.0 generates the following SQL
statement UPDATE PART SET WHERE PARTID= ?.
This problem does not occur when using a bidirectional relationship
between Whole and Part. Is there an error in the mapping file somewhere?
Thanks in advance,
Stijn
database schema
<table name="PART">
<column name="PARTID" type="bigint"/>
<fk to-table="WHOLE">
<join column="PARTID" to-column="WHOLEID"/>
</fk>
</table>
<table name="WHOLE">
<column name="WHOLEID" type="bigint"/>
</table>
classes
public class Whole implements javax.jdo.InstanceCallbacks{
private java.util.Set parts = new java.util.HashSet();
public void jdoPreDelete {
//implements cascading delete
public class Part implements javax.jdo.InstanceCallbacks{
private int partid;
mapping
<class name="Whole">
<field name="parts">
<jdbc-field-map type="one-many" column.PARTID="PARTID"
ref-column.WHOLEID="PARTID" table="PART"/>
</field>This bug is caused by the fact that your FK is using a column that is
not nullable (in this case, because it is also a PK column). It is
definitely a bug on our side, but I wanted to let our users know that
most one-sided one-many relations won't exhibit this problem.
Thank you for the report; we will try to correct the problem in an
upcoming release. -
Kodo JDO with JCA provided by Jencks in Tomcat
I'm trying to use both JDO and JCR (Apache's Jackrabbit) in my project. Both support XA
Transactions, and my understanding is that to best ensure data integrity, I should start using them.
Currently, I'm running under Tomcat using the SpringFramework support for transactions. I'd like to
continue running in Tomcat because I already understand that environment and the other app-servers
all feel heavyweight by comparison - all I need is JNDI and XA Transactions. Tomcat itself doesn't
support XA Transactions and JCA, but the open source project jencks is able to provide JCA support
within Tomcat.
I've been looking at the Deployment section of the JDO reference guide (Chapter 8). If I'm reading
this right, all I need to do is set two properties in the jdo.properties file: kodo.TransactionMode
and kodo.ManagedRuntime.
I've done that in my project:
kodo.TransactionMode: managed
kodo.ManagedRuntime: invocation(
TransactionManagerMethod=edu.ucsc.whisper.transaction.KodoTransactionAccess.getTransactionManager )
The getTransactionManager() is a static function that returns the
javax.transaction.TransactionManager provided by Spring's JtaTransactionManager.
I have a unit test that checks the application's initialization process, and I've been using that to
work my way into JCA transactions. Based on that test, this seems to be working. My question is this:
Is it really that simple?
Don't get me wrong, I'll be thrilled if it is, but from everything I'm seeing about configuring the
"Big Iron" app servers (WebLogic, JBoss, etc.), it just seems like adding two properties is too easy
and that I'm probably missing something significant in the process. Can anyone confirm whether or
not I'm on the right track here?
I'm working on setting this up for my heavier-duty integration tests, but I'm concerned that if I am
missing something, I've done just enough to fake Kodo out and that it isn't actually working under
the hood.
Thanks,
MarkAbe White wrote:
I would be surprised if your transaction manager and JDBC driver
configured themselves for XA automatically, since it imposes some
overhead and is rarely actually needed. In particular, you typically
need an XADataSource for XA transactions, rather than just using the
standard JDBC driver through the DriverManager (as Kodo does internally
when you specify ConnectionDriverName). So I suggest you consult their
documentation. As far as Kodo is concerned, though, as long as you've
set the TransactionMode, ManagedRuntime,
DataSourceMode/ConnectionFactoryMode (depending on Kodo version), and
are using an XA DataSource, you are all set.Hi Abe,
I've been able to get Spring configured so that it uses its JtaTransactionManager, and I have Kodo
setup with the TransactionMode as Managed and the ManagedRuntime is configured to use a static
method I created that returns the TransactionManager. In my logs, I can see Kodo accessing a
non-null instance of the TransactionManager class through this method. The problem that I'm getting
is that the behavior in my unit and integration tests is different than the behavior I'm seeing when
running in Tomcat, even though the Spring and Kodo configuration are nearly identical (Kodo accesses
a different database in Tomcat than it does in testing, other than that, the configuration is the
same). All the unit and integration tests pass; this requires transactions to be created, data
written to the database through Kodo, and then read back through Kodo in a new transaction. When I
deploy the web-app to Tomcat though, Kodo suddenly thinks its running without transactions. Reading
from the database works fine because I've got non-transactional reads turned on, but as soon as I
try to alter any field of a persisted object, Kodo throws an InvalidStateException saying it doesn't
have a transaction. I've included my log output below to demonstrate.
The only thing I haven't done yet, based on your previous message, is configure my database driver
for access through JNDI within Tomcat. Would that cause errors like this, or should I be looking
elsewhere?
My jdo.properties file contains these settings:
# For use of JDOHelper
javax.jdo.PersistenceManagerFactoryClass: kodo.jdo.PersistenceManagerFactoryImpl
# For Kodo JDO 4.0 EA2 and higher
javax.jdo.option.Connection2DriverName: org.postgresql.Driver
javax.jdo.option.Connection2UserName: ------------
javax.jdo.option.Connection2Password: ------------
javax.jdo.option.Connection2URL: jdbc:postgresql://127.0.0.1:5432/my_db
javax.jdo.option.Optimistic: true
javax.jdo.option.RetainState: true
javax.jdo.option.NontransactionalRead: true
kodo.FlushBeforeQueries=true
# For JCA Transaction support
kodo.TransactionMode: managed
kodo.ManagedRuntime: invocation(
TransactionManagerMethod=edu.ucsc.whisper.transaction.KodoTransactionAccess.getTransactionManager )
Thanks,
Mark
2006-04-04 02:03:13,891 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<mdslog - TransactionInterceptor starting create if necessary>
2006-04-04 02:03:13,891 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<mdslog - TransactionAspectSupport begin createTransactionIfNecessary()>
2006-04-04 02:03:13,891 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Getting transaction for edu.ucsc.whisper.service.UserService.setUserInformation>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager begin getTransaction>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <Using
transaction object [org.springframework.transaction.jta.JtaTransactionObject@42b645]>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] -
<Creating new transaction with name [edu.ucsc.whisper.service.UserService.setUserInformation]>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- JtaTransactionManager begin doBegin>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- JtaTransactionManager end doBegin>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager end getTransaction>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager begin newTransactionStatus>
2006-04-04 02:03:13,892 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Initializing
transaction synchronization>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager end newTransactionStatus>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<mdslog - TransactionAspectSupport end createTransactionIfNecessary()>
2006-04-04 02:03:13,892 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<mdslog - TransactionInterceptor finished create if necessary>
2006-04-04 02:03:13,892 INFO [edu.ucsc.whisper.service.DefaultUserService] - <setUserInformation begin>
2006-04-04 02:03:13,892 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context [WebApplicationContext for namespace 'xfire-servlet']:
org.acegisecurity.event.authorization.PublicInvocationEvent[source=invocation: method 'getUser',
arguments [mark]; target is of class [edu.ucsc.whisper.core.manager.DefaultUserManager]]>
2006-04-04 02:03:13,892 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context [Root WebApplicationContext]:
org.acegisecurity.event.authorization.PublicInvocationEvent[source=invocation: method 'getUser',
arguments [mark]; target is of class [edu.ucsc.whisper.core.manager.DefaultUserManager]]>
2006-04-04 02:03:13,892 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Opening JDO PersistenceManager, factory = kodo.jdo.PersistenceManagerFactoryImpl@c2c9af>
2006-04-04 02:03:13,893 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] - <New
JDO PersistenceManager = kodo.jdo.PersistenceManagerImpl@cc70c2, factory =
kodo.jdo.PersistenceManagerFactoryImpl@c2c9af>
2006-04-04 02:03:13,893 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Registering transaction synchronization for JDO PersistenceManager>
2006-04-04 02:03:13,893 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <mdslog -
TransactionSynchronizationManager registerSynchronization -
org.springframework.orm.jdo.PersistenceManagerFactoryUtils$PersistenceManagerSynchronization@ff0f8a>
2006-04-04 02:03:13,893 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Bound value
[org.springframework.orm.jdo.PersistenceManagerHolder@552f12] for key
[kodo.jdo.PersistenceManagerFactoryImpl@c2c9af] to thread [http-8443-Processor24]>
2006-04-04 02:03:13,893 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@552f12] for key
[kodo.jdo.PersistenceManagerFactoryImpl@c2c9af] bound to thread [http-8443-Processor24]>
2006-04-04 02:03:13,893 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Persistence manager kodo.jdo.PersistenceManagerImpl@cc70c2, factory
kodo.jdo.PersistenceManagerFactoryImpl@c2c9af is transactional: true>
2006-04-04 02:03:13,893 DEBUG [kodo.Query] - <Executing query: [SELECT UNIQUE FROM
edu.ucsc.whisper.core.DefaultUser WHERE username==searchName
PARAMETERS java.lang.String searchName] with parameters: {searchName=mark}>
2006-04-04 02:03:13,894 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> connection pool: active=0, idle=1>
2006-04-04 02:03:13,894 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> checkout>
2006-04-04 02:03:13,895 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> prepared statement cache: size=9,
max=50, requests=17, hits=8, created=9, redundant=0, overflow=0, leaked=0>
2006-04-04 02:03:13,902 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [5 ms] executing
prepstmnt 6033738 SELECT t0.userId, t0.TYP, t0.VERSN, t0.enabled, t0.password, t1.userInfoId,
t1.TYPE, t1.VERSN, t1.aboutText, t1.familyName, t1.firstName, t1.gender, t1.namePrefix,
t1.nameSuffix, t1.otherNames, t2.userId, t2.TYP, t2.VERSN, t2.enabled, t2.password, t2.USERINFO,
t2.username, t0.username FROM whisper_user t0 LEFT OUTER JOIN userinfo t1 ON t0.USERINFO =
t1.userInfoId LEFT OUTER JOIN whisper_user t2 ON t1.userInfoId = t2.USERINFO WHERE (t0.username = ?)
[params=(String) mark] [reused=3]>
2006-04-04 02:03:13,906 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [2 ms] executing
prepstmnt 12702178 SELECT t0.nameOrder, t0.previousName FROM userInfo_PreviousNames t0 WHERE
t0.userInfoId = ? ORDER BY t0.nameOrder ASC [params=(long) 2] [reused=3]>
2006-04-04 02:03:13,908 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [1 ms] executing
prepstmnt 7374726 SELECT t1.authorityId, t1.TYP, t1.VERSN, t1.authority FROM user_authorities t0
INNER JOIN authorities t1 ON t0.authorityId = t1.authorityId WHERE t0.userId = ? [params=(long) 2]
[reused=3]>
2006-04-04 02:03:13,912 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [2 ms] executing
prepstmnt 1745355 SELECT t0.organizationId, t0.TYPE, t0.VERSN, t0.city, t0.country, t0.isPrimary,
t0.orgName, t0.positionTitle, t0.postalCode, t0.state, t0.streetAddress1, t0.streetAddress2,
t0.streetAddress3, t0.userId FROM organization t0 WHERE t0.userId = ? [params=(long) 2] [reused=3]>
2006-04-04 02:03:13,912 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> return>
2006-04-04 02:03:13,912 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> [0 ms] close>
2006-04-04 02:03:13,913 INFO [edu.ucsc.whisper.security.WhisperAccessDecisionManager] - <voting on
access to: invocation: method 'getUserInfoForUser', arguments [{DefaultUser: username=mark;
password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}]; target is of class
[edu.ucsc.whisper.core.manager.DefaultUserManager], with auth:
edu.ucsc.whisper.security.WhisperClientAuthenticationToken@798d8: Username: {DefaultUser:
username=mark; password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}; Password:
[PROTECTED]; Authenticated: true; Details: null; Granted Authorities: {DefaultAuthority:
authority=ROLE_USER}>
2006-04-04 02:03:13,913 INFO [edu.ucsc.whisper.security.UserIsOwnerOrAdminVoter] - <voting with auth
= edu.ucsc.whisper.security.WhisperClientAuthenticationToken@798d8: Username: {DefaultUser:
username=mark; password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}; Password:
[PROTECTED]; Authenticated: true; Details: null; Granted Authorities: {DefaultAuthority:
authority=ROLE_USER}, o = invocation: method 'getUserInfoForUser', arguments [{DefaultUser:
username=mark; password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}]; target is of
class [edu.ucsc.whisper.core.manager.DefaultUserManager], config = [ROLE_USER, ROLE_ANONYMOUS,
AFTER_ACL_READ]>
2006-04-04 02:03:13,913 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context [WebApplicationContext for namespace 'xfire-servlet']:
org.acegisecurity.event.authorization.AuthorizedEvent[source=invocation: method
'getUserInfoForUser', arguments [{DefaultUser: username=mark;
password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}]; target is of class
[edu.ucsc.whisper.core.manager.DefaultUserManager]]>
2006-04-04 02:03:13,914 DEBUG [org.springframework.web.context.support.XmlWebApplicationContext] -
<Publishing event in context [Root WebApplicationContext]:
org.acegisecurity.event.authorization.AuthorizedEvent[source=invocation: method
'getUserInfoForUser', arguments [{DefaultUser: username=mark;
password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}]; target is of class
[edu.ucsc.whisper.core.manager.DefaultUserManager]]>
2006-04-04 02:03:13,914 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@552f12] for key
[kodo.jdo.PersistenceManagerFactoryImpl@c2c9af] bound to thread [http-8443-Processor24]>
2006-04-04 02:03:13,915 DEBUG [kodo.Query] - <Executing query: [SELECT FROM
edu.ucsc.whisper.core.UserAccessControl
WHERE aclObjectId.domainObjectId==searchObjectId.domainObjectId
PARAMETERS edu.ucsc.whisper.core.DomainObjectIdentity searchObjectId] with
parameters: {searchObjectId=edu.ucsc.whisper.core.DefaultUserInfo:mark}>
2006-04-04 02:03:13,917 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> connection pool: active=0, idle=1>
2006-04-04 02:03:13,917 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> checkout>
2006-04-04 02:03:13,917 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> prepared statement cache: size=9,
max=50, requests=21, hits=12, created=9, redundant=0, overflow=0, leaked=0>
2006-04-04 02:03:13,919 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [2 ms] executing
prepstmnt 11249989 SELECT t0.accessControlId, t0.VERSN, t0.aclObjectId, t0.aclObjectParentId,
t0.permit, t1.userId, t1.TYP, t1.VERSN, t1.enabled, t1.password, t2.userInfoId, t2.TYPE, t2.VERSN,
t2.aboutText, t2.familyName, t2.firstName, t2.gender, t2.namePrefix, t2.nameSuffix, t2.otherNames,
t3.userId, t3.TYP, t3.VERSN, t3.enabled, t3.password, t3.USERINFO, t3.username, t1.username FROM
user_access_control t0 LEFT OUTER JOIN whisper_user t1 ON t0.userId = t1.userId LEFT OUTER JOIN
userinfo t2 ON t1.USERINFO = t2.userInfoId LEFT OUTER JOIN whisper_user t3 ON t2.userInfoId =
t3.USERINFO WHERE (t0.aclObjectId = ?) [params=(String) edu.ucsc.whisper.core.DefaultUserInfo:mark]
[reused=1]>
2006-04-04 02:03:13,920 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> return>
2006-04-04 02:03:13,921 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> [1 ms] close>
2006-04-04 02:03:13,921 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Retrieved value
[org.springframework.orm.jdo.PersistenceManagerHolder@552f12] for key
[kodo.jdo.PersistenceManagerFactoryImpl@c2c9af] bound to thread [http-8443-Processor24]>
2006-04-04 02:03:13,921 DEBUG [kodo.Query] - <Executing query: [SELECT FROM
edu.ucsc.whisper.core.AuthorityAccessControl
WHERE aclObjectId.domainObjectId==searchObjectId.domainObjectId
PARAMETERS edu.ucsc.whisper.core.DomainObjectIdentity searchObjectId] with
parameters: {searchObjectId=edu.ucsc.whisper.core.DefaultUserInfo:mark}>
2006-04-04 02:03:13,923 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> connection pool: active=0, idle=1>
2006-04-04 02:03:13,924 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> checkout>
2006-04-04 02:03:13,924 DEBUG [kodo.jdbc.JDBC] - <<t 11706420> prepared statement cache: size=9,
max=50, requests=22, hits=13, created=9, redundant=0, overflow=0, leaked=0>
2006-04-04 02:03:13,927 DEBUG [kodo.jdbc.SQL] - <<t 11706420, conn 15885558> [2 ms] executing
prepstmnt 4389286 SELECT t0.accessControlId, t0.VERSN, t0.aclObjectId, t0.aclObjectParentId,
t0.permit, t1.authorityId, t1.TYP, t1.VERSN, t1.authority FROM authority_access_control t0 LEFT
OUTER JOIN authorities t1 ON t0.authorityId = t1.authorityId WHERE (t0.aclObjectId = ?)
[params=(String) edu.ucsc.whisper.core.DefaultUserInfo:mark] [reused=1]>
2006-04-04 02:03:13,928 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> return>
2006-04-04 02:03:13,928 DEBUG [kodo.jdbc.JDBC] - <<t 11706420, conn 15885558> [0 ms] close>
2006-04-04 02:03:13,928 INFO [edu.ucsc.whisper.core.dao.JdoAclDao] - <found the controls:
[{AuthorityAccessControl: aclObjectId=edu.ucsc.whisper.core.DefaultUserInfo:mark;
aclObjectParentId=null; permit=READ_WRITE; recipient={DefaultAuthority: authority=ROLE_ADMIN}},
{UserAccessControl: aclObjectId=edu.ucsc.whisper.core.DefaultUserInfo:mark; aclObjectParentId=null;
permit=READ_WRITE; recipient={DefaultUser: username=mark;
password=871deb9e1c3dd967da1d4f6d01999eb71a4eab71; isEnabled=true}}]>
2006-04-04 02:03:13,928 INFO [edu.ucsc.whisper.service.DefaultUserService] - <Updating user info for
mark>
2006-04-04 02:03:13,929 INFO [edu.ucsc.whisper.service.DefaultUserService] - <existing user info =
{DefaultUserInfo: prefix=null; firstName=null; otherNames=null; familyName=null; suffix=null;
previousNames=(); gender=0; aboutText=null}>
2006-04-04 02:03:13,929 INFO [edu.ucsc.whisper.service.DefaultUserService] - <new user info =
{UserInfoData: prefix=Mr.; firstName=Mark; otherNames=David; familyName=Slater; suffix=null;
previousNames=(); gender=0; aboutText=blah blah blah}>
2006-04-04 02:03:13,930 DEBUG
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - <Applying rules to
determine whether transaction should rollback on <4|false|4.0.0EA4> kodo.util.InvalidStateException:
To perform writes on persistent data outside of a transaction, the "NontransactionalWrite" property
must be set on the Transaction.
FailedObject: edu.ucsc.whisper.core.DefaultUserInfo-2>
2006-04-04 02:03:13,930 DEBUG
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - <Winning rollback rule
is: null>
2006-04-04 02:03:13,930 DEBUG
[org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - <No relevant rollback
rule found: applying superclass default>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.interceptor.TransactionInterceptor] -
<Invoking rollback for transaction on edu.ucsc.whisper.service.UserService.setUserInformation due to
throwable [<4|false|4.0.0EA4> kodo.util.InvalidStateException: To perform writes on persistent data
outside of a transaction, the "NontransactionalWrite" property must be set on the Transaction.
FailedObject: edu.ucsc.whisper.core.DefaultUserInfo-2]>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager begin rollback>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager begin processRollback>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager begin triggerBeforeCompletion>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] -
<Triggering beforeCompletion synchronization>
2006-04-04 02:03:13,934 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager - synchronization =
org.springframework.orm.jdo.PersistenceManagerFactoryUtils$PersistenceManagerSynchronization@ff0f8a>
2006-04-04 02:03:13,934 DEBUG
[org.springframework.transaction.support.TransactionSynchronizationManager] - <Removed value
[org.springframework.orm.jdo.PersistenceManagerHolder@552f12] for key
[kodo.jdo.PersistenceManagerFactoryImpl@c2c9af] from thread [http-8443-Processor24]>
2006-04-04 02:03:13,934 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Persistence manager kodo.jdo.PersistenceManagerImpl@cc70c2, factory
kodo.jdo.PersistenceManagerFactoryImpl@c2c9af is transactional: false>
2006-04-04 02:03:13,935 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] -
<Closing JDO PersistenceManager>
2006-04-04 02:03:13,935 DEBUG [org.springframework.orm.jdo.PersistenceManagerFactoryUtils] - <
persistence manager = kodo.jdo.PersistenceManagerImpl@cc70c2, factory =
kodo.jdo.PersistenceManagerFactoryImpl@c2c9af>
2006-04-04 02:03:13,935 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <mdslog
- AbstractPlatformTransactionManager end triggerBeforeCompletion>
2006-04-04 02:03:13,935 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] -
<Initiating transaction rollback> -
Kodo.util.InternalException: null
Hello,
I'm trying new persistence EJB3 implementation from SolarMetric:
kodo-4.0.0EA3
I have constructed a simple test app. And when I try to run it I get:
Exception in thread "main" <1|true|4.0.0EA3> kodo.util.InternalException:
null
at
kodo.synthetic.com.dalitest.ClientKodoSyntheticSubclassProxy.kodoNewObjectIdInstance(Unknown
Source)
at kodo.util.ApplicationIds.create(ApplicationIds.java:246)
at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2433)
at kodo.kernel.BrokerImpl.persistSafe(BrokerImpl.java:2379)
at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2366)
at kodo.kernel.DelegatingBroker.persist(DelegatingBroker.java:1275)
at kodo.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:519)
at com.dalitest.Test.main(Test.java:21)
Do you know what is going on?
Here is my code:
package com.dalitest;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
public class Test
public static void main(String[] args)
EntityManagerFactory factory =
Persistence.createEntityManagerFactory("kodo");
EntityManager em = factory.createEntityManager();
Client c1 = new Client();
c1.setName("John Doe");
EntityTransaction t = em.getTransaction();
t.begin();
em.persist(c1);
t.commit();
and Client.java:
package com.dalitest;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.Column;
@Entity(access = AccessType.PROPERTY)
@Table(name="DALI_CLIENTS")
public class Client
private String id;
private String name;
public void setName(String name)
this.name = name;
@Column(name="NAME")
public String getName()
return name;
public void setId(String id)
this.id = id;
@Id
@Column(name="ID")
public String getId()
return id;
and my persistence.xml:
<?xml version="1.0"?>
<entity-manager>
<name>kodo</name>
<provider>kodo.persistence.PersistenceProviderImpl</provider>
<class>com.dalitest.Client</class>
<properties>
<property name="kodo.LicenseKey"
value="XXX" />
<property name="kodo.ConnectionURL"
value="XXX" />
<property name="kodo.ConnectionDriverName"
value="oracle.jdbc.driver.OracleDriver" />
<property name="kodo.ConnectionUserName" value="XXX" />
<property name="kodo.ConnectionPassword" value="XXX" />
<property name="kodo.Log" value="DefaultLevel=WARN, Tool=INFO" />
</properties>
</entity-manager>
Where I have masked some values with XXX for this post.
Thanks in advance,
RuslanAlso I tried to enable DEBUG mode
<property name="kodo.Log" value="DefaultLevel=WARN, Tool=INFO" />
And got the following output before this exception:
15 INFO [main] kodo.Runtime - Starting Kodo 4.0.0EA3
62 DEBUG [main] kodo.Runtime - License capabilities: "Kodo Standard
Edition,Kodo Community Edition,Kodo Evaluation Edition,Datacache
Plug-in,Custom Result Object Providers,Custom Mappings,Enterprise
Databases,Query Extensions,Performance Pack,Statement Batching,Kodo
Enterprise Edition,Managed Environment,Developer Tools,Custom
DBDictionaries" Expiration: "2/25/06 7:00 PM" Maintenance expiration:
"2/25/06 7:00 PM"
187 INFO [main] kodo.jdbc.JDBC - Using dictionary class
"kodo.jdbc.sql.OracleDictionary".
343 INFO [main] kodo.MetaData - Found 1 classes with metadata in 0
milliseconds.
422 INFO [main] kodo.MetaData - parse-class
422 INFO [main] kodo.MetaData - parse-package
Exception in thread "main" <1|true|4.0.0EA3> kodo.util.InternalException:
null
at
kodo.synthetic.com.dalitest.ClientKodoSyntheticSubclassProxy.kodoNewObjectIdInstance(Unknown
Source)
at kodo.util.ApplicationIds.create(ApplicationIds.java:246)
at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2433)
at kodo.kernel.BrokerImpl.persistSafe(BrokerImpl.java:2379)
at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2366)
at kodo.kernel.DelegatingBroker.persist(DelegatingBroker.java:1275)
at kodo.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:519)
at com.dalitest.Test.main(Test.java:21) -
Error after creating a function using SE37
Hello friends
I have created a simple function (remote enabled).
Syntax check says everything is ok.
When I try to Activate, I get the following error message.
Program SAPLZBAPI_CONFIGDNA_INSERT
REPORT/PROGRAM statement missing, or program type is I (INCLUDE).
The name of the function that I have created is ZBAPI_CONFIGDNA_INSERT.
However, it is complaining about a program SAPLZBAPI_CONFIGDNA_INSERT.
I have created BAPIS before and so I am sure that the steps I have created are ok.
I even tried creating the same BAPI with different names and still the same problem.
Any feedback will be greatly appreciated.
Thanks
Ramin the TOP Include the statement
FUNCTION-POOL (<b>Name of function Group</b>).
is missing.
to Reach to th eexact point.
to to attibutes tab of your FM
double click on Program Name.
double click on include ending with TOP.
Declare the statement in the TOP include.
amandeep. -
Please, Not getting result set from callable statement (Code posted)
I am posting some simple code which should get a ResultSet from a CallableStatement object using the executeQuery() Method.
It is returning "No RsultSet was produced"
If I modify the code and simply output the CallableableStatement using its executeUpdate() then getString() methods it works fine. Anything obviously wrong with this bit of code? Thanks.
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import db.util.query.*;
import db.util.pool.*;
public class oracle extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
response.setContentType("text/html");
java.io.PrintWriter out = response.getWriter();
Connection con = ConnectionFactory.getConnection();
CallableStatement cs = null;
ResultSet rs = null;
int intID = 1;
try{
cs = con.prepareCall("{? = call test1(?)}");
cs.registerOutParameter(1, java.sql.Types.VARCHAR);
cs.setInt(2,intID);
/*These lines work on their own
*cs.executeUpdate();
*out.println("Name is : " + cs.getString(1));
//this code is what is not working...hmm
rs = cs.executeQuery();
while(rs.next()){
out.println(rs.getString("name"));
rs.close();
cs.close();
//the rest of this works too.
ConnectionFactory.releaseConnection(con);
catch(SQLException e){
out.println(e.getMessage());
Here's the stored procedure. I'm just trying to do a simple test to return multiple rows. The table has numberous records with the same id which is being passed to the function.
create or replace function test1 ( strInputID IN testtable.id%type)
return varchar2
is
strOutputName testtable.name%type;
found_it EXCEPTION;
begin
select name into strOutputName from testtable
where id = strInputID;
raise found_it;
exception
when no_data_found
then
return null;
when found_it
then
return strOutputName;
end;I've posted the code...it's doing a select. I think the problem is that to return multiple rows I need to return a cursor. But I've run into problems with both the MS and Oracle Drivers.
All I really want to do is to query a database using a callable statement(function in oracle) which will return multiple rows which I can process. I have been trying to do this in a servlet.
I can do it successfully for one column from one row, but not multiple columns from mulitple rows.
I've been searchging for some good examples and am trying different things but can't seem to get it to work. -
Bank statement and bank clearing document splitting
Hi,
We have main bank and bank clearing accounts classified as cash category.
Our bank statement uses a Z document type that posts transactions such as:
- debtor to main bank
- vendor to main bank
- expense to main bank
- revenue to main bank
Thereafter, the bank clearing that is done between main bank and bank clearing account (so a cash to cash rule is needed based on the GL account classification)
We needed to use an unspecified posting rule to cater for the bank statement posting as the standard did not allow us to add vendor, debtor, expense, revenue as base item categories. But it doesnt allow us to add cash to cash.
How should we configure document splitting to cater for this?Hi ,
First of all i hope you are clear with the concept of Incoming , otugoing and main bank account that we need to create 3 or more diffrent bank accounts for reconcilliation purpose .
the case here is that you cant to do a manual statement upload then in that case you will have to take care of following things .
How is the information transferred from FICA to FICO means along with the reconcilliation key what else information are you passing on to FI in the documents .
Secondly in the bank statement are you getting the reconcilliation key ??? or what information are you getting in the bank statement ???
because the integration of FI and FICA is the reco key and it becomes very crucial for you to have the same in the bank statement .
thirdly , Use the manual reconcillaiton functionality provided in FI for reconciling the same , where in you will have to configure the manual bank statement functionality and by using the T code ff67 you can reconcile it .
Hope this suffices the prupose .
Do revert back in case of any other queries .
cheers ,
dewang -
HI ALL
WHERE CAN I FIND ALL THE FUNCTION MODULES USED IN ABAP AND I ALSO NEED EXPLANATIONS ....CAN ANYONE HELP
WITH REGARDS
VIJAYHi,
You can use the table TFDIR to see all the fun modules in ABAP.
see the doc and links for further details
Function Modules;
Check this matter.
Function Modules are Glopbal ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
You can create them from TCode SE37.
Go through the following doc:
Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
Function Module Interfaces
The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
Syntax
... [IMPORTING parameters]
[EXPORTING parameters]
[CHANGING parameters]
[TABLES table_parameters]
[{RAISING|EXCEPTIONS} exc1 exc2 ...]
The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
Interface parameters
The interface parameters are defined on the relevant tab pages in the Function Builder.
IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
Exceptions
The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
Note
For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
RFC is a technology which is used to access a functions (Modules) from
the remote systems.
If a function module is set as remote enabled which can be access from
the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
But Normal function modules can not accessd from the remote system.
Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
CALLING A FUNCTION MODULE:
1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
--> Write the Corresponding FM name --> Hit Enter
2)The appropriate import ,export Parameters will be displayed in ur editor
3)Pass the Values Here.
Also check these links.
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
See the following links:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
reward if useful
regards,
Anji -
How to call pl/sql function from oaf
Dear Friends,
I am trying to call a function from oaf page .but iam getting error like
java.sql.SQLException: ORA-01861: literal does not match format string
ORA-06512: at line 1
THis is my function ,,callable statement
FUNCTION CAR_LOAN_VALIDATION(P_PERSON_ID IN NUMBER
,P_DEDUCTION_START_DATE IN DATE
,P_DEDUCTION_END_DATE IN DATE
,P_LOAN_VALUE IN NUMBER
RETURN VARCHAR2
IS
l_message VARCHAR2(100);
l_contract_type VARCHAR2(50);
l_loan_eligible_date DATE;
l_grade VARCHAR2(15);
l_old_loan_end_date DATE;
l_max_loan_end_date DATE;
l_remaining_amount NUMBER;
l_eligible_amt NUMBER;
BEGIN
BEGIN
SELECT --papf.person_id,
(SELECT meaning
FROM hr_lookups
WHERE lookup_type = 'ADTC_CONTRACT_TYPE'
AND lookup_code = attribute3) contract_type,
ADD_MONTHS (papf.original_date_of_hire, 11) loan_eligible_date,
DECODE (paaf.ass_attribute2,
'Chairman', 'Chairman',
SUBSTR (ass_attribute2, INSTR (ass_attribute2, '.', 1, 1) + 1,
3)
) grade,
(SELECT nvl(MAX (deduction_end_date),null)
FROM xxadtc_car_loan_request
WHERE person_id = p_person_id) old_loan_end_date,
to_date(ADD_MONTHS (p_deduction_start_date, 47)) max_loan_end_date
--to_date(ADD_MONTHS (sysdate, 47)) max_loan_end_date
INTO l_contract_type
,l_loan_eligible_date
,l_grade
,l_old_loan_end_date
,l_max_loan_end_date
FROM per_all_people_f papf, per_all_assignments_f paaf
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.business_group_id = 81
AND papf.person_id = paaf.person_id
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND papf.person_id =P_PERSON_ID;
EXCEPTION
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
-- get Previous Car loan amount --
BEGIN
SELECT to_number(prrv.result_value)
INTO l_remaining_amount
FROM per_all_people_f papf,
per_all_assignments_f paaf,
pay_assignment_actions pac,
pay_run_results prr,
pay_run_result_values prrv,
pay_element_types_f petf,
pay_input_values_f pivf,
pay_element_classifications pec,
pay_payroll_actions ppa,
per_time_periods ptp
WHERE SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
AND papf.person_id = paaf.person_id
AND papf.business_group_id = 81
AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND paaf.assignment_id = pac.assignment_id
AND pac.assignment_action_id = prr.assignment_action_id
AND prr.run_result_id = prrv.run_result_id
AND prr.element_type_id = petf.element_type_id
AND SYSDATE BETWEEN petf.effective_start_date AND petf.effective_end_date
AND prrv.input_value_id = pivf.input_value_id
AND SYSDATE BETWEEN pivf.effective_start_date AND pivf.effective_end_date
AND pivf.NAME = 'Remaining Amount'
AND petf.classification_id = pec.classification_id
AND pac.payroll_action_id = ppa.payroll_action_id
AND ppa.time_period_id = ptp.time_period_id
AND TO_CHAR (ptp.pay_advice_date, 'Mon-YYYY') =
TO_CHAR (SYSDATE, 'Mon-YYYY')
AND petf.element_name = 'Motar Ahlami Loan'
--and employee_number='10185'
AND papf.person_id = p_person_id;
EXCEPTION
WHEN no_data_found THEN
--DBMS_OUTPUT.PUT_LINE('ERROR: No data!');
l_remaining_amount:=0;
WHEN others THEN
DBMS_OUTPUT.PUT_LINE('Error ');
END;
select GET_CAR_LOAN_ELIGI_AMT(P_PERSON_ID)
into l_eligible_amt
from dual;
IF l_contract_type NOT IN ('Permanent') THEN
l_message := 'Contract Type Is not valid';
END IF;
IF l_loan_eligible_date < SYSDATE THEN
l_message:= 'Date of Join is less then one year';
END IF;
IF l_grade IN ('US','00','AUS','EM') THEN
l_message:= 'Your are not Eligible Grade';
END IF;
IF l_old_loan_end_date < SYSDATE THEN
l_message:= 'Previous Loan Duration is not completed';
END IF;
IF l_max_loan_end_date > P_DEDUCTION_END_DATE THEN
l_message:= 'Maxinum number of monthly payment of 48 month';
END IF;
IF l_remaining_amount >0 THEN
l_message:= 'Previous Car Loan amount is pending till';
END IF;
IF l_eligible_amt < p_loan_value THEN
l_message:= 'Please check Eligible Amount ';
END IF;
RETURN nvl(l_message,'S');
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN 'Error';
END CAR_LOAN_VALIDATION;
END XX_CAR_LOAN_REQUEST_PKG;
CALLABLE STATEMENT CODE ---CO CODE
if(pageContext.getParameter("Submit")!=null) {
OAViewObject vo2 = (OAViewObject)am.findViewObject("XxadtcCarLoanRequestEOVO1");
if(vo1!=null){
vo1.getCurrentRow().setAttribute("LoanStatus","Pending Approval");
int xxpersonId = pageContext.getEmployeeId();
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate").toString();//pageContext.getParameter("DeductionStartDate").toString();
// SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate1 = dateFormat1.parse("xxDeductionStartDate");
String xxDeductionEndDate = vo2.getCurrentRow().getAttribute("DeductionEndDate").toString();//pageContext.getParameter("DeductionEndDate").toString();
// SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy/mm/dd");
// Date convertedDate2 = dateFormat2.parse("xxDeductionEndDate");
String xxLoanValue = vo2.getCurrentRow().getAttribute("LoanValue").toString();//pageContext.getParameter("LoanValue").toString();
int iLoanValue = Integer.parseInt(xxLoanValue);
System.out.println("Entered into submit loop");
System.out.println("xxpersonId id is:"+xxpersonId);
System.out.println("xxDeductionStartDate id is:"+xxDeductionStartDate);
System.out.println("xxDeductionEndDate id is:"+xxDeductionEndDate);
System.out.println("xxLoanValue id is:"+xxLoanValue);
OADBTransaction txn = am.getOADBTransaction();
String sql ="BEGIN :1 :=XXADTC_CAR_LOAN_REQUEST_PKG.CAR_LOAN_VALIDATION(:2,:3,:4,:5); END;";
CallableStatement cs = txn.createCallableStatement(sql,1);
String outputval = null;// int outputval = 0;
try {
System.out.println("Entered in try loop of callable funtion validation");
cs.setInt(2,xxpersonId);
System.out.println("cs setInt(2,xxpersonId);is executed");
cs.setString(3,xxDeductionStartDate);
System.out.println("cs.setString(3,xxDeductionStartDate is executed);");
cs.setString(4,xxDeductionEndDate);
System.out.println("cs.setString(4,xxDeductionEndDate is executed);");
// cs.setDate(3,xxDeductionStartDate);
// cs.setDate(4,xxDeductionEndDate);
cs.setInt(5,iLoanValue);
cs.registerOutParameter(1,Types.VARCHAR);// cs.registerOutParameter(1,Types.NUMERIC);
cs.execute();
outputval = cs.getString(1);// txn.commit();
System.out.println(outputval);
txn.commit();
if(outputval.equals("S"))
am.invokeMethod("apply");
else
throw new OAException("Organization name is:"+outputval,OAException.INFORMATION);
txn.commit();
catch(Exception sqle){
try {
cs.close();
catch (Exception e)
throw OAException.wrapperException(e);
throw OAException.wrapperException(sqle);
Please help .where is the error is.
please help
let me know for any clarification.
Thanks
Aravinda.Hi Arvinda,
Refer Below code.
// In Controller
java.sql.Date DeductionSDate; //declare variable
//In PFR
String xxDeductionStartDate = vo2.getCurrentRow().getAttribute("DeductionStartDate");
OADBTransaction txn = am.getOADBTransaction();
if(xxDeductionStartDate!=null)
java.sql.Date startDate= txn.getOANLSServices().stringToDate(xxDeductionStartDate);
DeductionSDate = startDate;
Set this to cs.setDate(3,DeductionSDate);
Thanks,
Dilip -
Bank Reconcilication - statement upload
Dear SAP Gurus,
In bank reconciliation, we have configured all the steps & the manual bank reconciliation is working fine. We are working in ECC 6.0 SAP version Our Client requires direct upload of the statement & post the bank outgoing & incoming entries in the system. For that , we used Multicash Format (auszug.txt and umsatz.txt) . We prepared an excel sheet giving the detail of each field in the txt. We then tried to upload in FF_5 , in the header & line item field of the FF_5 . We encountered with the following error while uploading.
RFEKA200 : Error when converting date
Message no : FB080
The dates were given as DD.MM.YY as said in SAP Note 36833 - Multicash Format (auszug.txt and umsatz.txt)
AnandDear Loiseau,
I am sending you the format of the SAP note for your reference.
SAP Note 36833 - Multicash Format (auszug.txt and umsatz.txt)
Note Language: English Version: 9 Validity: Valid Since 17.02.2004
Summary
Symptom
Multicash Format (auszug.txt and umsatz.txt)
More Terms
RFEBKA00, FF.5, mulitcash, RFEKA200, bank statement, electronic
format description
Cause and Prerequisites
Solution
The files have to be ASCII-coded, no quotes.
The delimiter between the fields is the semicolon ';'.
Type description:
A - Alphanumeric
N - Numbers
X - Date in Fomat DD.MM.YY
(Example 25.01.94 for January 25th of 1994)
AUSZUG.TXT
Field# Type min. max. opt. Description
1 A 0 12 bank key
2 A 0 24 bank account number
3 N 1 4 statement number
4 X 8 8 statement date
5 A 3 3 currency key
6 N 1 18.2 opening balance amount
7 N 1 18.2 debit total
8 N 1 18.2 credit total
9 N 1 18.2 closing balance amount
10 A 0 35 bank account holder
11 A 0 35 X special account name
12 X 8 8 X life start
13 X 8 8 X life end
14 0 0 not used
15 0 0 not used
16 0 0 not used
17 0 0 not used
18 N 1 5 number of records in statement
UMSATZ.TXT
==========
Field# Type min. max. opt. Description
1 A 0 12 bank key
2 A 0 24 bank account number
3 N 1 4 statement number
4 X 8 8 value date
5 N 1 10 X primary note number
12.03.2009 Page 2 of 3
SAP Note 36833 - Multicash Format (auszug.txt and umsatz.txt)
6 A 0 27 X note to payee 1
7 A 0 27 X bank posting text
8 0 0 not used
9 A 0 4 X text key
10 A 0 16 X check number
11 N 1 18.2 amount
12 0 0 not used
13 0 0 not used
14 X 8 8 Posting Date
15 0 00 not used
16 0 00 not used
17 A 0 27 X note to payee 2
18 A 0 27 X note to payee 3
19 A 0 27 X note to payee 4
20 A 0 27 X note to payee 5
21 A 0 27 X note to payee 6
22 A 0 27 X note to payee 7
23 A 0 27 X note to payee 8
24 A 0 27 X note to payee 9
25 A 0 27 X note to payee 10
26 A 0 27 X note to payee 11
27 A 0 27 X note to payee 12
28 A 0 27 X note to payee 13
29 A 0 27 X note to payee 14
30 A 0 27 X business partner
31 A 0 27 X business partner
32 A 0 12 X bank key of the partner's bank
33 A 0 24 X bank account number of the partner
34 A 0 3 X business transaction code
35 0 0 not used
Changes if multicash-EURO is used: (See also note 109893)
36 A 3 3 currency key (OCMT)
37 N 1 18.2 amount (OCMT)
Important:
Field 34 ( business transaction code ) or field 9 ( text key ) are used as
'External business transaction code (EBTC)' in Table T028G.
If field 34 and field 9 are both empty then field 7 (bank posting text) is
used as EBTC.
Header Data
Release Status: Released for Customer
Released on: 19.02.2004 14:11:23
Original Lang.: German
Priority: Recommendations/additional info
Category: Release planning information
Main Component: TR-CM-CM Basic Functions
12.03.2009 Page 3 of 3
12.03.2009 Page 3 of 3
SAP Note 36833 - Multicash Format (auszug.txt and umsatz.txt)
The Note is release-independent
Related Notes
Number Short Text
529355 Bank statement/Multicash: note to payee fields too long
130395 RFEKA200: Four-digit year MultiCash file processing
124655 Non-supported electronic bank statement functions
13283 Description of electronic bank statements.
Regards
Anand -
in function module how to export all the fields in a table ..
i.e. i am giving these fields..
in
IMPORT
P_EBELN LIKE EKKO-EBELN
IN
EXPORT
BUKRS LIKE EKKO-BUKRS
and in source code
SELSCT SINGLE BUKRS INTO BUKRS
WHERE EBELN = EBELN.
and i am getting for one record
but if i want to export more than one columns
how to code it in source code.
and what is the use of TABLES in FM
AND HOW TO EXPORT full table columns ?
and how to code it ...
plz help me .......Hi
See the doc on fun modules and create accordingly
Function Modules;
Check this matter.
Function Modules are Global ABAP programs created by SAP for reusable purpose.they have IMPORT,EXPORT and TABLE parameters, and EXCEPTIONS to through when error occurs.
You can create them from TCode SE37.
Go through the following doc:
Function modules are cross-program, reusable procedures that are organized into function groups, and whose functions are implemented between the statements FUNCTION and ENDFUNCTION. Function modules and their interfaces are created in the Function Builder.
Function Module Interfaces
The parameter interface of a function module is defined in the Function Builder. It includes the definition of interface parameters and the specification of exceptions that can be triggered by a function module. The Function Builder automatically generates comment lines below the FUNCTION statement in the source code of the function module, which represent the interface of the function module with the following syntax:
Syntax
... [IMPORTING parameters]
[EXPORTING parameters]
[CHANGING parameters]
[TABLES table_parameters]
[{RAISING|EXCEPTIONS} exc1 exc2 ...]
The syntax and semantics of IMPORTING, EXPORTING, CHANGING, RAISING, and EXCEPTIONS mainly correspond to the definition of method interfaces with [CLASS-]METHODS. The additional option of defining table parameters using TABLES is obsolete.
Interface parameters
The interface parameters are defined on the relevant tab pages in the Function Builder.
IMPORTING parameters are input parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input parameter. The content of the actual parameter is passed to the input parameter when the call is made. The content of an input parameter for which 'pass by reference' is defined cannot be changed in the function module.
EXPORTING parameters are output parameters. When the function module is called, a suitable actual parameter can be specified for every output parameter. The content of an output parameter that is defined for 'pass by value' is transferred to the actual parameter if the function module is completed without errors. An output parameter that is defined for pass by reference is not initialized when the function module is called.
CHANGING parameters are input and output parameters. When the function module is called, a suitable actual parameter must be specified for every non-optional input or output parameter. When the function module is called, the content of the actual parameter is passed to the input/output parameter, and when the function module is completed, the content of the input/output parameter is passed to the actual parameter.
TABLES parameters are table parameters. Table parameters are obsolete CHANGING parameters that are typed as standard tables with a header line. If an internal table without a header line or a table body is passed as an actual parameter to a formal parameter of this type, an empty local header line is generated in the function module. If an internal table with a header line is used as an actual parameter, both the table body and the header line are passed to the function module. Pass by value is not possible in formal parameters defined using TABLES. Formal parameters defined with TABLES can be replaced by formal parameters defined with CHANGING. A local work area can be created for the internal table in the function module by using the addition LIKE LINE OF itab of the DATA statement.
Exceptions
The exception of a function module are defined on the Exceptions tab page in the Function Builder. Here you can select exception classes to define whether class-based exceptions are declared or non-class-based exception are defined. Class-based exceptions are represented in the above syntax by RAISING, and non-class-based exceptions are represented by EXCEPTIONS.
The addition RAISING is used to declare class-based exceptions that can be propagated from the function module to the caller. Exceptions in the categories CX_STATIC_CHECK and CX_DYNAMIC_CHECK must be explicitly declared, otherwise a propagation can lead to an interface violation. A violation of the interface leads to the treatable exception CX_SY_NO_HANDLER. Exceptions of the category CX_NO_CHECK are implicitly always declared. The declaration of exceptions of the category CX_STATIC_CHECK is statically checked in the syntax check. For exceptions of the category CX_DYNAMIC_CHECK, the check is not performed until runtime. In a function module in which class-based exceptions are declared with the RAISING addition, the statement CATCH SYSTEM-EXCEPTIONS cannot be used. Instead, the relevant treatable exceptions should be handled in a TRY control structure.
The addition EXCEPTIONS is used to define a list of non-class-based exceptions that can be triggered in the function module using the statements RAISE or MESSAGE RAISING. Exceptions defined in this way - as with formal parameters - are bound to the function module and cannot be propagated. If an exception of this type is triggered in a function module, and no return value has been assigned to it with the homonymous addition EXCEPTIONS of the CALL FUNCTION statement when the call was made, this leads to a runtime error.
Note
For new developments after release 6.10, SAP recommends that you work with class-based exceptions that are independent of the function module.
RFC is a technology which is used to access a functions (Modules) from
the remote systems.
If a function module is set as remote enabled which can be access from
the remote system via RFC.Eg: U can access the Remote enabled function modules in ur VB,Webdynpro,Java,Visual composer program.
A function module can be set as remote enabled by SE37->Go to ur FM->click the option Button "remote enabled".
But Normal function modules can not accessd from the remote system.
Good Example for RFC enabled function module is : BAPI(Business Application Programming Interface)
Note: All BAPIs are Remote enabled but not all remote enabled function modules are BAPI.
CALLING A FUNCTION MODULE:
1)In U ABAP Editor --> Click "Patter" ---> Selection Option Button "Call Function"
--> Write the Corresponding FM name --> Hit Enter
2)The appropriate import ,export Parameters will be displayed in ur editor
3)Pass the Values Here.
Also check these links.
http://www.geocities.com/victorav15/sapr3/abapfun.html
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
Check this link:
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/d94b78ebf811d295b100a0c94260a5/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
See the following links:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005vp/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm
<b>Reward points for useful Answers</b>
Regards
Anji
Maybe you are looking for
-
IPhoto is a pain in my behind!
why is ordering a calendar with my own pictures so HARD...I can get it from Walmart or Walgreens but not Apple???
-
Hey all- Anyone possibly know why my iPod has no option for "TV Shows" in the Videos menu? Any video labelled as a TV Show does not, therefore, display on my iPod...I could always just label all my TV Shows as movies, but I think that would annoy the
-
Customize the look of this forum as per my requirement
I am a oracle dba and newbe to this forum. Here is my question. I want to view and follow up only few categories in this forum. I have bookmarked oracle database category in this forum and it is also having few categories which i am not interested in
-
Sound Blaster Audigy Gamer not being recogni
Hi, I own the Sound Blaster Audigy Gamer. It had been working fine before I needed to update the drivers. When I tried to update the drivers it said that no Audigy Card was being detected and that the Setup would close. The first person at Creative I
-
FCPX crash to black screen when skimming clips
I'm on a Mac Book Pro... running 10.6.8 Processor Name: Intel Core i5 Processor Speed: 2.53 GHz Number Of Processors: 1 Total Number Of Cores: 2 L2 Cache (per core): 256 KB L3 Cache: 3 M