facebook

domain code – how to change globally "@Table(catalog =

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #318584 Reply

    tilo2k2
    Member

    Hello,

    I am using myeclipse for spring 9.1 and using Scaffold Spring CRUD application to generate Spring MVC application. The source code is generated with many different layers. In every java files in the domain layer, there is an annotation as below

    @Table(catalog = “databaseDEV”, schema = “dbo”, name = “employee”)

    When I deploy my app to ITG and Production, then I need to change my catalog name as below

    @Table(catalog = “databaseITG”, schema = “dbo”, name = “employee”)
    @Table(catalog = “databasePRO”, schema = “dbo”, name = “employee”)

    Is there a way that I can change the “@Table(catalog = ….” globally without go into every java files and change the catalog name?

    Thanks in advance for yor help!

    #318640 Reply

    jkennedy
    Member

    I think you have a few options here and it may depend on they type and layout of your db.

    Which DB are you using, and which version, and driver, etc.

    My recommendation would be to try an experiment to remove the catalog from the annotation all together for your DB to see if that works for your configuration.

    I believe in most cases this will default the catalog to the default catalog / schema for the user you are connecting to the database with…

    If you reach the point where you would prefer a different approach for the Catalog naming strategy during scaffolding, you can create an customization project and override the templates.

    Here is a video on that process:

    You would need to update the DataType.jet
    The line of code is: <persistence:table select=”$model”/>
    which invokes our tag that emits the Table annotation and replace it with your own code.

    It may be easier to configure your DB connection with the default catalog and then just remove all of the catalog=’xxxx’ strings.

    Thanks,
    Jack

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: domain code – how to change globally "@Table(catalog =

You must be logged in to post in the forum log in