Spring TopLink Integration Preview Updated

The preview of the Spring TopLink Integration support has been updated on OTN. Changes are described in the release notes.
Also check out the OTN article Of Persistence and POJOs: Bridging the Object and Relational Worlds on using TopLink with Spring by Rod Johnson and Jim Clarke.

You will not have to change any java code when you switch "transaction controller" strategies in your Spring beans.xml file.
When you talk about "the way you use the UnitOfWork in your code", you're talking about the section in the "Transactions" chapter called "External Transaction Controllers" right? In any case, the differences at the java level, are essentially that you acquire an "active" UnitOfWork (getActiveUnitOfWork) and that you no longer explicitly commit the UnitOfWork.
Neither of these two differences impacts your use of TopLink within Spring. In Spring, the transaction is always managed by a Spring PlatformTransactionManager so your TopLink code will never call commit, whether you're using an ExternalTransactionController or not. The code will be identical whether you're running in J2SE or J2EE.
Also, since we expect users to access TopLink either through a TopLinkTemplate or through a TopLinkInterceptor, the Spring container will always "inject" a TopLink Session that is aware of whether or not there is currently an ExternalTransactionController. So, there will be no difference between the behavior of acquireUnitOfWork and getActiveUnitOfWork. Both will behave identically. They will return you the UOW currently associated with the current Spring PlatformTransactionManager. So, there is no environmental dependency here either.
JIM

Similar Messages

  • Spring-TopLink Integration and transparent transaction controller

    Hi,
    I'm new to TopLink and I read the article in the "Mastering J2EE" series about the Spring TopLink integration. I never actually got into Spring before, so I went and checked out the articles and tutorials and then I went back to my exploration of TopLink.
    From what I understood, Spring promises that you wouldn't need to change your code, only your configuration files, if you change your transaction controller from the OR framework transaction controller to a JTA enabled one provided by the AS. But when I read the "Transactions" chapter in the TopLink application developer's guide, it seemed that the way you use the UnitOfWork in your code differs significantly depending on whether you're using an external transaction controller.
    My question is, does this void Spring's promise or is there a work around for that?
    Thanks.

    You will not have to change any java code when you switch "transaction controller" strategies in your Spring beans.xml file.
    When you talk about "the way you use the UnitOfWork in your code", you're talking about the section in the "Transactions" chapter called "External Transaction Controllers" right? In any case, the differences at the java level, are essentially that you acquire an "active" UnitOfWork (getActiveUnitOfWork) and that you no longer explicitly commit the UnitOfWork.
    Neither of these two differences impacts your use of TopLink within Spring. In Spring, the transaction is always managed by a Spring PlatformTransactionManager so your TopLink code will never call commit, whether you're using an ExternalTransactionController or not. The code will be identical whether you're running in J2SE or J2EE.
    Also, since we expect users to access TopLink either through a TopLinkTemplate or through a TopLinkInterceptor, the Spring container will always "inject" a TopLink Session that is aware of whether or not there is currently an ExternalTransactionController. So, there will be no difference between the behavior of acquireUnitOfWork and getActiveUnitOfWork. Both will behave identically. They will return you the UOW currently associated with the current Spring PlatformTransactionManager. So, there is no environmental dependency here either.
    JIM

  • When will Spring-Toplink integration be officially released in Spring

    I notice from previous emails that Spring-Toplink integration will eventually be part of the Spring framework itself (similair to existing Hibernate, iBatis, JDO integration). Can you tell me when this will occur? What version of Spring is being targeted?
    thankyou,
    Chris

    Chris,
    The work is going on right now to have the work checked in and included in Spring 1.2.
    Doug

  • Spring-TopLink Integration Available

    A preview of our integration with Spring is available now.
    http://www.oracle.com/technology/products/ias/toplink/preview/spring/index.html
    We are working on contributing this into Spring and hope to have it available from the Spring Framework website in the future.
    As always, your feedback is appreciated via this forum,
    Doug

    You will not have to change any java code when you switch "transaction controller" strategies in your Spring beans.xml file.
    When you talk about "the way you use the UnitOfWork in your code", you're talking about the section in the "Transactions" chapter called "External Transaction Controllers" right? In any case, the differences at the java level, are essentially that you acquire an "active" UnitOfWork (getActiveUnitOfWork) and that you no longer explicitly commit the UnitOfWork.
    Neither of these two differences impacts your use of TopLink within Spring. In Spring, the transaction is always managed by a Spring PlatformTransactionManager so your TopLink code will never call commit, whether you're using an ExternalTransactionController or not. The code will be identical whether you're running in J2SE or J2EE.
    Also, since we expect users to access TopLink either through a TopLinkTemplate or through a TopLinkInterceptor, the Spring container will always "inject" a TopLink Session that is aware of whether or not there is currently an ExternalTransactionController. So, there will be no difference between the behavior of acquireUnitOfWork and getActiveUnitOfWork. Both will behave identically. They will return you the UOW currently associated with the current Spring PlatformTransactionManager. So, there is no environmental dependency here either.
    JIM

  • Spring / Toplink Transaction / Commit Issue

    Hi,
    Im working on a spring / toplink integration on my project.
    The problem Im facing has to do with transaction / commits
    Im using a TransactionProxyFactoryBean to encapsulate a BusinessProcess responsible for creating a new Company Instance and its main Office.
    As the 2 entity have to be created atomicly I have setup a PROPAGATION_REQUIRED on the createCompanyAndMainOffice method of the CompanyBusinessProcess.
    The problem is I want to return a session, identified company object and I cant see how to do that correctly.
    I tried and create a sub internal method like internalTXCreate called by createCompanyAndMainOffice, that would be the one transactional, so I get the commit at the end of its execution, returning the working copy with the newly inserted id, and perform a load with its its ID on the session from createCompanyAndMainOffice.
    But it seems that the TransactionalProxyFactoryBean only intercepts calls on the 'entry point' methods... so back to where I started ...
    I check the reference petclinic implementation and the only new* method does mention it returns a non identified BusinessObject which I find a bit disturbing in my case ...
    Any idea on the problem ?
    Thanks for your help,
    Best Regards
    Olivier Cuzacq
    Software Architect
    Groupe Moniteur

    Something like this in createCompanyAndMainOffice should work:
    return (Owner)getTopLinkTemplate().registerObject(new Owner());
    post-commit, the returned Object will be a reference from Toplink shared cache.

  • [svn:bz-trunk] 23048: Update BlazeDS trunk to use Spring BlazeDS integration 1.5.0.RELEASE build .

    Revision: 23048
    Revision: 23048
    Author:   [email protected]
    Date:     2011-10-18 08:34:43 -0700 (Tue, 18 Oct 2011)
    Log Message:
    Update BlazeDS trunk to use Spring BlazeDS integration 1.5.0.RELEASE build. 
    Added Paths:
        blazeds/trunk/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex /samples/secured/SecurityHelper.java.UNCOMMENT
        blazeds/trunk/lib/spring/spring-flex-core-1.5.0.RELEASE.jar
    Removed Paths:
        blazeds/trunk/apps/samples-spring/WEB-INF/src/spring-samples/src/org/springframework/flex /samples/secured/SecurityHelper.java
        blazeds/trunk/lib/spring/org.springframework.flex-1.0.3.RELEASE.jar

    The information you provided is totally useless for determining the problem.
    If it helps, I think the message you are getting is related to BlazeDS not being able to find the service class you are calling. You either have a typo somewhere, or you didn't set up a secure channel in your service config (I am assuming you meant SSL and not SSH).

  • Windows 2012 R2 hyper-v integration services update - error code: 50

    Physical Host is a brand new Windows 2012 R2 with hyper-v role, VM is a Windows Server 2012
    I try to upgrade the integration services update, VM become unresponsive and I lost connection to it,  had to turn it off, afterwards it wouldn't boot.
    Tried F8 on the reboot and then switched to the command prompt to manually upgrade the integration services running the setup, but got an error (Error code: 50 )
    VM halts in the middle of booting up.
    saying: Please wait ...
    Anyone has any idea why it happened and how to fix this?

    Hi Seyed,
    Please try to follow the link below to install integration services manually :
    http://blogs.technet.com/b/virtualization/archive/2013/04/19/how-to-install-integration-services-when-the-virtual-machine-is-not-running.aspx
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Bridge CS6 - extremely slow preview updates and image deleting

    1. Updating previews (100%) is very slow.
    Bridge CS6 has problems updating the previews of images that get edited.
    While creating preview from scratch is rather swift, updating previews takes about six minutes on a MacBook Pro retina with 16Gb RAM.
    After one minute the preview gets updated,  but then the busy signal in the low left corner just keeps turning and turning for five more minutes.
    Why is this happening? Is Bridge still busy with those previews? Why? The preview has already been updated, why those extra five minutes of business?
    2. Image deleting is painfully slow.
    You type Command + Delete, and nothing is happening for five, six seconds.
    Only then the images get deleted.
    Has anybody else noticed these two hold-ups?
    Edit:
    I just went back after writing and editing this post, and Bridge is still busy with the preview update. This is now 15 minutes after the image had been edited. The busy signal in the lower left corner just never turns off again.
    It feels like Bridge has also problems working in the background. As soon as you open e.g. a browser to bridge the waiting for bridge, Bridge seems to keep the busy signal rotating, but not actually doing anything until you close the browser again. Which is why I just had a 15 minute wait for an image preview to finally update. The time spent in the browser did not "count".

    Hi Noel,
    Yes, I did the upgrade, and I did not experience any problems.
    Only, the issues above were not fixed in the update.
    Are you not experiencing the same issues? (I'm on a Mac).
    C. Pfaffenbichler, I was actually looking for a dedicated Bridge forum, but I couldn't see a Bridge icon.

  • Approval Center Preview Updates not displaying a populated Views list

    Goal is to be able to add Baseline fields to Preview Updates.
    In trying to edit the view in Approval Center other entries ("change the view of Approval center" and "Adding the baseline (tracking) columns to the Approval Center view") indicate the solution is to use the View in Preview Updates
    and imply that the Tasks Tracking view is the view to update for Preview Updates.
    However, the view that I am seeing in Preview Updates does not
    match any view within Manage Views, including Tasks Tracking.
    The Preview Updates displays the following columns:
    ID
    Mode
    Task Name
    Previous Duration
    Duration
    Previous Start
    Start
    Previous Finish
    Finish
    Baseline Work
    Work
    Previous % Complete
    % Complete
    Resource Name
    The Tasks Trackingview already includes Baseline Start/Baseline Finish (and other differences) ... so not the view being used.
    Within Project Center after selecting a project and then selecting Schedule the view list has all expected views defined in Manage Views > Project. 
    But within Preview Updates the View drop down does not invoke a list of views.  So now I am wondering if this is the root problem for this issue I am having.
    Cheryl

    Hi Cheryl,
    I just tested your concern in my Project Online instance. As far as I know, there are no significative changes in the preview updates feature between 2010 and 2013 versions.
    As I said in your previous post, you are several views available in the "preview updates" page (unfortunately in french).
    Those views are the project views that are not related to resources and assignments, meaning all the "... tasks" project views should be available in the preview updates page. Then just edit one of those view adding your fields and save it.
    I tried to edit the task summary project view, adding a few field like bsaeline start and finish and it worked perfectly. Note that each field impacted by the update will be duplicated, for example the start date will be duplicated to a "previous start date"
    field.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • Windows 2008 Hyper-v Guest - BSOD after Integrated Services updated

    Hi,
    Hyper-V single node with Windows 2012 R2 Datacenter - the VM had its Integrated Services update and rebooted properly. After that, Windows 2008 start and shows BSOD as listed below - safe mode doesn't work. Any tips?
    Vinicius Deschamps

    Hi deschamps,
    Is the VM brand new setup ?
    Did you try to attach the VM's VHDx file to another new created VM ?
    Also you can try to mount the vhdx file and copy Dump File (default path  %SystemRoot%)then analysis it :
    http://blogs.technet.com/b/juanand/archive/2011/03/20/analyzing-a-crash-dump-aka-bsod.aspx
    Best Regards
    Elton JI
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Spring BlazeDS Integration

    Spring BlazeDS Integration
    this is the best tutorial for Spring BlazeDS Integration go to  http://codexamples.blogspot.com
    1. Configuring and Using the BlazeDS
    MessageBroker with Spring
    MessageBroker is the heart of the Spring BlazeDS Integration.
    When HTTP messages come from Flex client will be routed through the
    Spring DispatcherServlet to the Spring-managed MessageBroker.
    There is no need to configure the BlazeDS MessageBrokerServlet when using the
    Spring-managed MessageBroker.
    2. Configuring the Spring DispatcherServlet
    web.xml is the heart of the j2ee web project.So we have to configure it because
    each an every request is map to web.xml.
    The DispatcherServlet must be configured  in web.xml to bootstrap a Spring
    WebApplicationContext. For example:
    <!-- The front controller of this Spring Web application, responsible for handling all application requests -->
    <servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/config/web-application-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    3. Configuring the MessageBroker in Spring
    A simplified Spring XML config namespace is provided for configuring the MessageBroker in
    your WebApplicationContext. To use the namespace support you must add the schema location
    in your Spring XML config files. A typical config will look something like the following:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:flex="http://www.springframework.org/schema/flex"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/flex
    http://www.springframework.org/schema/flex/spring-flex-1.0.xsd">
    </beans>
    Following XML config namespace tags makes the Spring BlazeDS Integration configuration tags available under the flex
    namespace in your configuration files. The above setup will be assumed for the rest of the
    configuration examples to follow. For the full detail of every attribute and tag available in the
    config namespace, be sure to refer to the spring-flex-1.0.xsd as every element and attribute is
    fully documented there. Using an XSD-aware XML editor such as the one in Eclipse should
    bring up the documentation automatically as you type.
    At a minimum, the MessageBrokerFactoryBean must be configured as a bean in your
    Spring WebApplicationContext in order to bootstrap the MessageBroker, along with a
    MessageBrokerHandlerAdapter and an appropriate HandlerMapping (usually a
    SimpleUrlHandlerMapping) to route incoming requests to the Spring-managed
    MessageBroker.
    These beans will be registered automatically by using the provided message-broker tag in
    your bean definition file. For example, in its simplest form:
    <flex:message-broker/>
    This will set up the MessageBroker and necessary supporting infrastructure using sensible
    defaults. The defaults can be overriden using the provided attributes of the message-broker
    tag and its associated child elements. For example, the default location of the BlazeDS XML
    configuration file (/WEB-INF/flex/services-config.xml) can be overridden using the
    services-config-path attribute. The MessageBrokerFactoryBean uses Spring's
    ResourceLoader abstraction, so that typical Spring resource paths may be used. For
    example, to load the configuration from the application's classpath:
    <flex:message-broker services-config-path="classpath*:services-config.xml"
    The equivalent MessageBrokerFactoryBean definition using vanilla Spring configuration 
    would be: 
    <!-- Bootstraps and exposes the BlazeDS MessageBroker --> 
    <bean id="_messageBroker" class="org.springframework.flex.core.MessageBrokerFactoryBean" > 
    <property name="servicesConfigPath" value="classpath*:services-config.xml" /> 
    </bean> 
    Note especially that with the message-broker tag, it is not necessary to assign a custom id to
    the MessageBroker, and it is in fact discouraged so that you won't have to continually reference
    it later. The only reason you would ever need to provide a custom id is if you were bootstrapping
    more than one MessageBroker in the same WebApplicationContext.

    this is the best tutorial  
    Is it because you have made the site ??
    To be frank , there is nothing special or great  in that materail .
    Try to make a nice and simple  copy of working example like roseindia or Abhi on java  and post it .People like me definately want them .

  • JPA. Toplink executes an update instead of an insert

    Hello,
    I work with TopLink Essentials.
    My code:
    create a new Department, dept1, and persist it.
    The transaction is commited and the entity manager closed. dept1 is detached. One on the property of dept1 is modified.
    Meanwhile, the row with teh data of dept1 is deleted directly in the database.
    Then dept1 is merged into another entity manager:
    dept2 = (Department) em2.merge(dept1);
    and a new transaction is commited. One new row would be created in the database, wouldn't it?
    Result of the execution of my code: no row in the database that corresponds to dept1 (or dept2).
    The logs write that Toplink launch an update (update department where id = <old id of dept1>) instead of an insert and it is why no new row is inserted in the database. Certainly, TopLink thinks it exists a row with the same id in the database (because of the cache?).
    I have tried to use refresh or to tell to TopLink not to use the cache but nothing works. Can you tell me how to solve my problem?
    Thanks in advance for your help.

    It looks like you are hitting an issue related to the unconfirmed bug described at
    https://glassfish.dev.java.net/issues/show_bug.cgi?id=3084
    If you have a support contract, you can file a bug with Oracle support to get this fixed.
    The workaround is to use persist instead of merge for new objects. If you are using a later version, you might also try finding/refreshing the entity - the fix bug 3323 should find it no longer exists, causing it to be removed from the shared cache.
    Best Regards,
    Chris

  • ANN: Spring 1.2 with TopLink Integration Released

    Version 1.2 of the Spring Framework has been released. New in the 1.2 final release is support for TopLink "out of the box". Prior to 1.2, TopLink support was an "add on" that was available on OTN. Now Spring ships with the integration code required to use TopLink as a persistence provider. TopLink 10.1.2 (9.0.4) and 10.1.3 (preview) are supported.
    To get started, try out the Pet Clinic sample app configured to use TopLink.
    NB: Spring doesn't include TopLink; it provides the necessary integration classes. You still need to download both Spring and TopLink.
    - Shaun
    Spring Home page: http://www.springframework.org
    Spring 1.2 Announcement: http://www.springframework.org/node/86

    Version 1.2 of the Spring Framework has been released. New in the 1.2 final release is support for TopLink "out of the box". Prior to 1.2, TopLink support was an "add on" that was available on OTN. Now Spring ships with the integration code required to use TopLink as a persistence provider. TopLink 10.1.2 (9.0.4) and 10.1.3 (preview) are supported.
    To get started, try out the Pet Clinic sample app configured to use TopLink.
    NB: Spring doesn't include TopLink; it provides the necessary integration classes. You still need to download both Spring and TopLink.
    - Shaun
    Spring Home page: http://www.springframework.org
    Spring 1.2 Announcement: http://www.springframework.org/node/86

  • JDeveloper Developer Preview Updates - An Open Letter

    I recently was scanning through this forum and saw a thread on updates to the preview edition. In this thread, an Oracle spokesperson said that the developer preview goes through almost as rigorous a process as a production release, therfore; previews are updated infrequently. Most of the comments on thread indicate that people want more, not fewer, updates. Indeed, if I cared about the stability of the product, I would be running 9.x of JDeveloper. NO. Want I want to do is receive FREQUENT updates to the preview and be able to provide immediate feedback. It also seems that Oracle should LISTEN to their customers. While the product manager may have legitimate reasons for thinking fewer updates is better, the customers seem to be saying that the PM is wrong. We all want the same thing, JDeveloper to be the best Jave IDE available, period. I can hear in my head the polite response from Oracle justifying infrequent updates. But the justification isn;t necessary. It was clear to me that people are getting frustrated with the current version and have begun moving on. In that case it wion't matter how good the next Jdeveloper is because nobody will see it. They will al be using Eclipse or Idea.
    Sincerely, Keith Williams

    I respectfully remind you that the feature footprint of the entire JDeveloper 10.1.3 product is really quite massive, compared to the open source projects you're likely thinking about. We're talking about much more than a core IDE that lets you code and debug. The full JDeveloper product is on the order of magnitude of a Visual Studio Enterprise Architect Edition -- with, I'd argue, even more functionality than that has -- in a product that is now free. We surely have tons of automated regressions tests, automated UI interaction testing, and performance testing in all the various layers of the product, but the number of different use cases to test when you begin mixing and matching the various:
    -- view-layer technologies we support (JSP, JSF, Swing, Mobile clients)
    -- controller-layer technologies we support (Struts, JSF Navigation Cases)
    -- business tier-layer technologies we support (JavaBeans, EJB 2.0, EJB 2.1, EJB 3.0, TopLink, WebServices, XML, ADF Business Components, etc)
    -- J2EE application servers that we support
    -- database servers that we support
    -- open source technologies we provide integrated support for (JUnit, Ant, XDoclet, CVS)
    -- platforms we test running on (Windows, Linux, Mac)
    Makes for a meaty set of use cases that all need to be verified before we're satisfied with the quality.
    When you release something that delivers less end-to-end functionality or doesn't support the same matrix of different technology and server configurations, there's obviously less to test.
    There is currently no other development environment on the market (open source or otherwise, J2EE or .NET) that delivers the same features-to-price ratio that we do, and with the 10.1.3 release, we're raising that bar an order of magnitude higher.
    We hope you'll be impressed with the results, despite its extended "gestation" period. We're as excited to get an early access release into your hands as hopefully you will be to give it a spin and give us feedback on.

  • Spring JDBC - multiple getJdbcTemplate().update(...) calls in same DAO func

    Hello there.
    I am using pure spring jdbc to connect to a single mysql instance. My DAO class extends JdbcDaoSupport and I am inserting parent and child data into their respective tables by making two calls to getJdbcTemplate().update(...). However, an exception is raised upon call of the second (the child) insert, stating the parent table doesn't have a record with the child expects should be there. I run a query against the parent and child tables, and neither record is there..
    I should also note that inserts do occur when i set autocommit to true in the datasource configuration. However, when I set autocommit to false, i get an exception, as described above.
    Here are my questions:
    1. How does getJdbcTemplate() work when managing a connection?
    2. Does calling getJdbcTemplate() each of the two times means I'll get 2 separate (or unique) connections?
    3. For question #2, I've also tried creating a local JdbcTemplate variable (let's call it myJdbcTemplate) that points to a single getJdbcTemplate() call. However, when calling myJdbcTemplate.update(...) for both the parent and then the child inserts, I get the same problem.
    4. How can I resolve this issue? Must I use some sort of spring jdbc database transaction object?
    Any responses or sample code would be appreciated.
    Here's my current datasource configuration:
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverClassName}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
    <property name="maxActive" value="100"/>
    <property name="maxIdle" value="30"/>
    <property name="maxWait" value="1000"/>
    <property name="defaultAutoCommit" value="false"/>
    <property name="removeAbandoned" value="true"/>
    <property name="removeAbandonedTimeout" value="60"/>
    <property name="validationQuery" value="Select sysdate() from dual"/>
    </bean>
    Edited by: MrVince on Oct 4, 2008 12:27 AM

    duffymo wrote:
    MrVince wrote:
    Hello there.
    I am using pure spring jdbc to connect to a single mysql instance. My DAO class extends JdbcDaoSupport and I am inserting parent and child data into their respective tables by making two calls to getJdbcTemplate().update(...). However, an exception is raised upon call of the second (the child) insert, stating the parent table doesn't have a record with the child expects should be there. I run a query against the parent and child tables, and neither record is there..\Not enough information to tell. Can you boil this down to a SSCE?I'm not clear on what you're asking for here. I did a quick google search for the term SSCE but am unclear about what you're talking about here. Can you provide a little more context to what you're asking for? If it takes too long or if it's going to bother you in responding, please disregard this part of my post. Are you asking for a DDL for those two specific tables?
    >
    Are you using a transaction manager? At the time I posted the question, no. See below for some detail.
    Do you have a service that owns the transaction?At the time I posted the question, no. See at the bottom of the post for an update.
    >
    A parent/child relationship implies a foreign key relationship between the parent primary key and a child field. Does the parent primary key exist? Yes.
    Is the child field allowed to be null? No.
    How do you acquire the parent primary key to insert into the child field?From this variation of JdbcTemplate's update method:
    int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder) Using logging, I can confirm a key is being returned. I use this key in the insert of the child. The key is of the expected value.
    >
    I should also note that inserts do occur when i set autocommit to true in the datasource configuration. However, when I set autocommit to false, i get an exception, as described above.Right, because the parent primary key hasn't been committed yet.
    Are you using InnoDB tables? They're the only MySQL tables that enforce referential integrity.
    Yes.
    Here are my questions:
    1. How does getJdbcTemplate() work when managing a connection?What does "work" mean?
    You can get an idea by looking at Spring's source for the class. Your question isn't clear.I will rephrase. Will a new connection be retrieved (or attempted to be retrieved) each time getJdbcConnection() is called? Your response in the above quote snippet and the one below seem to address this, however.
    >
    2. Does calling getJdbcTemplate() each of the two times means I'll get 2 separate (or unique) connections?No, you'll get a reference to the connection that the template has. It doesn't acquire a new connection; it simply uses the connection that was injected into it.
    As mentioned just above, this helps me understand. Thanks.
    3. For question #2, I've also tried creating a local JdbcTemplate variable (let's call it myJdbcTemplate) that points to a single getJdbcTemplate() call. However, when calling myJdbcTemplate.update(...) for both the parent and then the child inserts, I get the same problem.
    4. How can I resolve this issue? Must I use some sort of spring jdbc database transaction object? Of course this should be a single unit of work. You wouldn't want the parent insert to succeed and the children to fail. Exactly. I appreciate you words of understanding and your agreement on what should be done.
    Update -- I made some changes since my original post.
    Upon googling I found this: [http://sujitpal.blogspot.com/2007/03/spring-jdbctemplate-and-transactions.html]. I decided to use what seemed to be the less invasive declarative approach. I made the following changes to my code:
    1. Updated my spring-ws-servlet.xml file to include a DataSourceTransactionManager.
    <bean id="transactionManager"
              class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
              <property name="dataSource" ref="dataSource" />
    </bean>2. In the same file, I also configure the TransactionProxyFactoryBean.
         <bean id="myDao"
              class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
              <property name="transactionManager" ref="transactionManager" />
              <property name="target" ref="testResultDao" />
              <property name="proxyTargetClass" value="true" />
              <property name="transactionAttributes">
                   <props>
                        <prop key="save*">PROPAGATION_REQUIRED</prop>
                        <prop key="*">PROPAGATION_SUPPORTS,readOnly</prop>
                   </props>
              </property>
         </bean>3. I then updated my maven pom.xml to include the following dependencies to support the additions I list above steps #1 and #2.
    <dependency>
         <groupId>cglib</groupId>
         <artifactId>cglib-nodep</artifactId>
         <version>2.1_3</version>
    </dependency>
    <dependency>
           <groupId>org.springframework</groupId>
           <artifactId>spring-aop</artifactId>
           <version>2.0-m4</version>
    </dependency>Here are other portions that may provide some relevance.
    The DAO implementation code.
    public class TestResultDaoImpl extends JdbcDaoSupport implements TestResultDao {
         public Integer saveStartedTestResult(TestResult testResult) {          
              KeyHolder genKeyHolder = new GeneratedKeyHolder();
              Integer testResultId = null;
                    // save parent record
              getJdbcTemplate().update(new SaveResultPac(testResult), genKeyHolder);
              testResultId = new Integer(genKeyHolder.getKey().intValue());
                    // save child records
              StringBuilder sqlStmt = new StringBuilder("INSERT into Selected_Transaction " );
              sqlStmt.append("(trans_type_id, test_result_id, create_date, last_update_date) ");
              sqlStmt.append("values(?, ?, sysdate(), ?) ");
              getJdbcTemplate().batchUpdate(sqlStmt.toString(), new SaveSelectedTransactionListBpss(testResultId, testResult.getSelectedTransactionList()));
              return testResultId;
          // more code
    }The declaration of the DAO bean, but I have a feeling this probably isn't relevant.
         <bean id="testResultDao" class="org.foobar.dao.impl.mysql.TestResultDaoImpl">
              <property name="dataSource" ref="dataSource"/>
        </bean>I inject testResultDao into there caller bean. Configuration is not listed here.
    After following the above three steps, I was able to compile and deploy my code to my local test server. When I execute the code, I still get same Foreign Key violation error.
    In light of your recommendations I think I'm going in the right direction. So what am I missing?
    Edited by: MrVince on Oct 5, 2008 12:39 AM

Maybe you are looking for

  • Can't find drivers for Satellite M30-842

    Hello, I am a repair technician, and I am repairing a European model Satellite with corrupted Windows; I have reformatted and I am installing Windows with my generic Windows XP Home CD. I have had no luck finding the drivers for (as listed in Device

  • In p6 8.2,I can't filter resources or role to resources planning

    in p6 8.2,"resources"section,"planning"page,"filter and group by" ,I open a dialog windows to select portfilos,projects,roles or resources ,but after I click the button"OK",the application have no changes, it also not retrun to the "planning" page an

  • Connecting a Buffalo Linkstation Live to an AE network

    I just bought a Buffalo Linkstation Live HS500GL on closeout at Circuit city. I have it hooked up to my AE via ethernet, but I can't "see" it on the network. The supplied software, the NAS Navigator seems to find it, and shows the IP address, and all

  • Out-of-warranty phone support

    My PSC 6180 has stopped printing wirelessly from my Windows 7 laptop.  I am considering buying the one-time phone support, but is that $20 for one phone call or one issue?  I seriously doubt I can fix this (if I even can) in one (or even two) phone c

  • Problem with analytic function

    Hi , I have table with fields : ID ,BUG_ID ,COMMENT_TEXT sample values are ID BUG_ID COMMENT_TEXT 1 2 test1 2 3 test1 3 2 test2 4 5 test1 5 5 test2 6 2 test3 and I am using following script to get the output like : BUG_ID CMNT_TEXT1 COMNT_TEXT2 CMNT_