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 6748807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:36:39+00:00 2026-05-26T12:36:39+00:00

Are there any tools or libraries that can be used to generate test data

  • 0

Are there any tools or libraries that can be used to generate test data using JPA or entity beans? I believe this will be very helpful for unit testing where we can have an in memory database with data dynamically generated just when we start our testing. So, there will be no communication with actual DB servers and not any waste of time.

I was only able to find JPAMock. But it is still under development. It would be nice if someone could provide a good pointer.

Thanks a lot.

  • 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-26T12:36:40+00:00Added an answer on May 26, 2026 at 12:36 pm

    I use DBUnit in conjunction with H2 database and untils & Spring. Works nicely:

    @SpringApplicationContext({ "classpath:test-context-dbunit.xml" })
    @Transactional(TransactionMode.ROLLBACK)
    @DataSet
    public class ApplicationDaoTest extends UnitilsTestNG {
    
        @SpringBeanByType
        private ApplicationDao applicationDao;
    
        @Test
        public void findAll() throws Exception {
            List<Application> actual = applicationDao.findAll();
            assertNotNull(actual);
            assertEquals(actual.size(), 3);
        }
    }
    

    The data is set in an XML file:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <dataset>
        <APPLICATION APPLICATION_ID="1" name="APP3" enabled="1" application_type="TRADE" api_key="AK1" auto_create_topics="1" />
        <APPLICATION APPLICATION_ID="2" name="APP1" enabled="1" application_type="TRADE" api_key="AK2" auto_create_topics="1" />
        <APPLICATION APPLICATION_ID="3" name="APP2" enabled="0" application_type="TRADE" api_key="AK3" auto_create_topics="1" />
    </dataset> 
    

    In Spring test context you define your datasource as such:

    <bean id="dataSource" class="org.unitils.database.UnitilsDataSourceFactoryBean"/>
    

    As dialect you use: org.hibernate.dialect.H2Dialect

    Finally a unitils.properties in your classpath like:

    database.driverClassName=org.h2.Driver
    database.url=jdbc:h2:mem:test
    database.user=sa
    database.password=
    database.schemaNames=public
    database.dialect=hsqldb
    

    UPDATE

    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="packagesToScan" value="..."/>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
            </props>
        </property>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any tools/libraries on Windows that can help me tarck down the culprit?
Are there any tools that can tell me what percentage of a XSL document
Does anyone know of any tests apps out there (or even libraries that can
Are there any libraries or tools specifically designed to help PHP programmers write Javascript?
Are there any tools that will spider an asp.net website and create a static
Are there any tools available that will calculate code metrics (for example number of
Is there any tool or addon which can be used for testing or identifying
I'm wondering if there are any 2D graph plotting libraries that run on the
Are there any tools to effectively compare two XML schema's? I have seen some
Are there any tools or plugins to design a Panel independently of a Form

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.