Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 427441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:34:41+00:00 2026-05-12T19:34:41+00:00

Here is my implementation in summary 1) all DAOs implemented using HibernateDAO support/ @Transational

  • 0

Here is my implementation in summary

1) all DAOs implemented using HibernateDAO support/ @Transational annotation is only used in Service layer

2) Use MySQL / HibernateTransactionManager

3) Test using main(String args[]) method (do transactions work using this method? )

Transactions does not get rollbacked and invalid entried can be seen in the database.
What am I doing wrong here?

Detailed information is given below.

1) I have configured transactions using @Transactional annotation in service layer as:

@Transactional(readOnly=false, rollbackFor={DuplicateEmailException.class,DuplicateLoginIdException.class,IdentityException.class},propagation=Propagation.REQUIRES_NEW)
    public void createUserProfile(UserProfile profile)
            throws DuplicateEmailException, DuplicateLoginIdException,
            IdentityException {

        //Accessing DAO (implemented using HibernateDAOSupport)
                identityDAO.createPrincipal(profile.getSecurityPrincipal());
        try {
                //Accessing DAO
            userProfileDAO.createUserProfile(profile);
        } catch (RuntimeException e) {
            throw new IdentityException("UseProfile create Error", e);
        }

    }

2) My Transation Manager configuration / datasource is as follows :

<bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url"
            value="jdbc:mysql://localhost:3306/ibmdusermgmt" />
        <property name="username" value="root" />
        <property name="password" value="root" />
        <property name="defaultAutoCommit" value="false"/>      
    </bean>

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />     
        <property name="mappingLocations"
            value="classpath*:hibernate/*.hbm.xml" />
        <property name="hibernateProperties">
                <prop key="hibernate.dialect">
                org.hibernate.dialect.MySQLDialect
                </prop>             
                <prop key="hibernate.query.substitutions">
                    true=1 false=0
                </prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.use_outer_join">false</prop>
            </props>
        </property>
    </bean>

    <bean id="transactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>

3) Test using main() method as follows :

public static void main(String[] args) {

        ApplicationContext cnt=new ClassPathXmlApplicationContext("testAppContext.xml");
        IUserProfileService upServ=(IUserProfileService)cnt.getBean("ibmdUserProfileService");

        UserProfile up=UserManagementFactory.createProfile("testlogin");//      
        up.setAddress("address");
        up.setCompany("company");
        up.setTelephone("94963842");
        up.getSecurityPrincipal().setEmail("security@email.com");
        up.getSecurityPrincipal().setName("Full Name");
        up.getSecurityPrincipal().setPassword("password");
        up.getSecurityPrincipal().setSecretQuestion(new SecretQuestion("Question", "Answer"));

        try {
            upServ.createUserProfile(up);
        } catch(Exception e){
            e.printStackTrace();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:34:41+00:00Added an answer on May 12, 2026 at 7:34 pm

    As far as I know, MySQL’s default storage engine MyISAM does not support transactions.

    MySQL Server (version 3.23-max and all versions 4.0 and above) supports transactions with the InnoDB and BDB transactional storage engines. InnoDB provides full ACID compliance. … The other nontransactional storage engines in MySQL Server (such as MyISAM) follow a different paradigm for data integrity called “atomic operations.” In transactional terms, MyISAM tables effectively always operate in autocommit = 1 mode

    In order to get transactions working, you’ll have to switch your storage engine for those tables to InnoDB. You may also want to use Hibernate’s MySQLInnodDBDialect if you generate your tables (hdm2ddl) from your mappings:

    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
    

    As mentioned by @gid, it’s not a requirement for transactions though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my short implementation of Russian Peasant Multiplication . How can it be
I have a RESTful service with the interface below, using POST. When I try
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here's a coding problem for those that like this kind of thing. Let's see
Here is the scenario: I'm writing an app that will watch for any changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.