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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:19:59+00:00 2026-06-01T07:19:59+00:00

Current I have a seperate maven module for my database access, all my DAO

  • 0

Current I have a seperate maven module for my database access, all my DAO classes inherit from:

public class GenericDaoImpl<T> extends JdbcDaoSupport implements GenericDao<T> {
}

My maven module has a spring dependancy:

org.springframework spring-orm

So a typical Dao class looks like:

public class UserDaoImpl extends GenericDaoImpl<User> implements UserDao {

    @Override
    public void insert(User user) {
        getJdbcTemplate().update("insert into users(...)...");
    }
}

My Dao’s get autowired with the dataSource bean.

Can I make this generic somehow so I can continue to use it in my spring MVC application, yet it will work if I need to use this library in a cron job service type environment? (without having to bring in spring’s application context into the picture).

  • 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-06-01T07:20:00+00:00Added an answer on June 1, 2026 at 7:20 am

    I’d start to observe the following:

    • You have a GenericDao<T> which means that you can have different implementations.
    • Currently, you have GenericDaoImpl<T> extends JdbcDaoSupport which means that you cannot use in the other environment you described without any application context unless you prepare all the object in a manual fashion.

    So my suggestion is:

    • Allow GenericDao<T> extends org.springframework.jdbc.core.JdbcOperations
    • Develop an AbstractGenericDao<T> implements GenericDao<T> to bring the abstract general functionality you need.
    • Develop a MyEnvGenericDao<T> extends AbstractGenericDao<T> that is responsible to provide a data source and underlying implementation of different methods you need; could be using a direct Hibernate/OpenJPA implementation to directly executing the queries.
    • Develop a SpringGenericDao<T> extends JdbcDaoSupport implements GenericDao<T> that comes is already with a getJdbcTemplate() to perform the operations you need and is delegated to Spring JDBC template. In this scenario, you need to delegate the operations to JdbcDaoSupport.getJdbcTemplate().

    Related to Maven, then you can actually have different modules for MyEnv and Spring implementations but both with one parent to have access to GenericDao<T> interface.

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

Sidebar

Related Questions

At current i have an index page which shows values from an XML page
I have seperate functions for reading from a text file (depending on whether its
I have many countdown timers on the page. Timers countdown remaining time from current
I have 1 JFrame and 10 JPanel components as seperate classes. There is also
I have current a developed app which I am going to submit in just
We have a current application where user login credentials are stored in a SQL
I have a current system which is build as a Windows Application, and does
I have the current basic structure for each domain object that I need to
I have my current location fixed via CoreLocation. Now I want to get those
I have the current PHP: $thisarray[] = #000; SetProfileField('usercss', $USER->id, implode(',',$thisarray)); Which writes #000

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.