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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:31:01+00:00 2026-05-13T18:31:01+00:00

I have A MySQL database currently in production use for a CakePHP application A

  • 0

I have

  • A MySQL database currently in production use for a CakePHP application
  • A Java SE application accessing the same database via Hibernate, currently in development.

I’m using the Netbeans “automigrate” feature to create the POJO classes and XML files (do I really need the XML files when using annotations?). As the schema is quite complex creating the tables manually is way too much work.

Cake expects all DB tables to be pluralized (the Address class is automagically mapped to the addresses table). When running the Netbeans automigration it then does pluralization on the already pluralized table names (I’m getting Addresses.java and setAddresseses() methods).

I know I’m asking for trouble running two very different data layers against the same database, but I’d like to know if it’s possible to have Netbeans generating the POJO classes in singular form or if there is another (better) way to manage this.

  • 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-13T18:31:02+00:00Added an answer on May 13, 2026 at 6:31 pm

    When doing reverse engineering, it is possible to use a custom reverse engineering strategy. Quoting the documentation:

    It is possible to implement a user
    strategy. Such strategy must implement
    org.hibernate.cfg.reveng.ReverseEngineeringStrategy.
    It is recommended that one uses the
    DelegatingReverseEngineeringStrategy
    and provide a public constructor which
    takes another
    ReverseEngineeringStrategy as
    argument. This will allow you to only
    implement the relevant methods and
    provide a fallback strategy. Example
    of custom delegating strategy which
    converts all column names that ends
    with “PK” into a property named “id”.

    public class ExampleStrategy extends DelegatingReverseEngineeringStrategy {
        public ExampleStrategy(ReverseEngineeringStrategy delegate) {
            super(delegate);
        }
        public String columnToPropertyName(TableIdentifier table, String column) {
            if(column.endsWith("PK")) {
                return "id";
            } else {
                return super.columnToPropertyName(table, column);
            }
        }
    }
    

    In your case, you might want to implement

    public String tableToClassName(TableIdentifier tableIdentifier) {
        return delegate==null?null:delegate.tableToClassName(tableIdentifier);
    }
    

    to “depluralize” classes generated from table names (ADDRESSES => Address).

    But sadly, the NetBeans Hibernate Reverse Engineering Wizard does not provide an option to pick reverse engineering strategy if the user happen to have any (this is an enhancement planned for NetBeans 7.0 if time permits).

    So if you want to use a custom strategy, you’ll have to use Ant or Maven. This is currently not possible from NetBeans.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer My experience is that desktop development is more productive than… May 16, 2026 at 6:57 am
  • Editorial Team
    Editorial Team added an answer You should remove your override of CreateRibbonExtensibilityObject. By default, this… May 16, 2026 at 6:57 am
  • Editorial Team
    Editorial Team added an answer select sm.NAME, sm.AverageScore, sm.best_score, s.SUBJECT from ( SELECT NAME, Avg(SCORE)… May 16, 2026 at 6:57 am

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.