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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 356k
  • Answers 356k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try comparing a 3.5 project file and a 4.0 project… May 14, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer In general to use a language service you query for… May 14, 2026 at 8:59 am
  • Editorial Team
    Editorial Team added an answer You could use a smudge/clean process (a gitattribute filter driver,… May 14, 2026 at 8:59 am

Related Questions

I found a code of winform here: http://www.wincustomize.com/articles.aspx?aid=136426&c=1 And it works fine as a
SUMMARY How can I make my GUI application run on windows startup on a
We are trying to look at optimizing our localization testing. Our QA group had
I'd like to pin IEnumerable implementations in memory with this generic extension method I'm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.