Generate sourcecode for Pojo to Pojo mapping

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #340257 Reply


    Hello everyone,

    we currently have a software, which uses two kinds of pojos to represent different models: one is the gui model, the other is the database model.
    Those two pojos are mapped using a mapping class. As the GUI may use information of different tables, the gui model may be mapped to multiple (but at least one) hibernate/database pojo(s).
    Each gui model has its own mapping class, which translates the gui/form pojo into the different hibernate/database pojos.

    What I would like to know:
    Does myEclipse offer a wizard or some other approach/help for creating source code for pojo type converter?

    It would also help, if the tool could parse existing code and generate some documentation of the mapping (e.g. visual approach as in Altova MapForce).
    Any advice is greatly appreciated, as I am stuck with more than 300 mapping classes, where I am currently trying to get my brains wrapped around it.

    Also for later maintenance it would greatly help, if the code for the mapping class could be auto-generated.

    Kind regards,

    System information:
    RedHat Enterprise Linux Release 6.1 (Santiago)
    Kernel Linux 2.6.32-131.17.1.el6.x86_64
    MyEclipse Enterprise Workbench
    Version: 10.5
    Build id: 10.5-20120615

    More information about my development pc can be provided, if handled confidentially. If needed, could you please provide a secure way of sending the information to you? I would not want to post any detailed pc information in this forum. Thank you for your understanding and support. Else, consider this obsolete.

    #340280 Reply



    I’m not sure I understand the requirement exactly. You seem to have Java classes that represent the elements of the GUI, classes that represent the business data and classes that map between the two. I’m not familiar with that kind of design but I don’t think we have functionality that can support that. In general, we offer support for frameworks, UML and visual code designers, within the context of enterprise development. Is there a framework or standard design technique which matches your requirement? If so, we might be able to offer some support in the future, through a feature request (there are forums specifically for that), if the request can be prioritised against other development work.

    I’m sorry I can’t offer more help.

    #340281 Reply


    Your description is exactly what the current situation is like.
    I want to map Pojo type A onto Pojo type B.

    My current idear is, to use JAXB to parse the java sourcecode of a POJO type A into xml, use XSLT to transform POJO of type A into POJO of type B, then use JAXB to generate the Java sourcecode out of POJO of type B again:

    Java: Pojo Type A ==> JAXB ==> XML. Pojo Type A ==> XSLT ==> XML: Pojo Type B ==> JAXB ==> Java: Pojo Type B

    Has anyone done this before or is there a more elegant way of doing this?
    Also: This approach would only provide me with code for Pojo Type B after parsing Pojo Type A, but would not auto-generate the sourcecode of class, which handles the type conversion (our Map-Class).

    Any hint/suggestions welcomed! Maybe some plugin in myEclipse aiding the developer in type mapping/transformation would be great. Or am I missing something entirely, which could be used instead?

    #340282 Reply



    I don’t think I’ve seen that type of requirement before. There are tools that can generate classes from database tables, in several ways but then those classes are used directly in the application, which could include GUI related classes but it seems as though you use a lot of database tables and columns in your GUI. If you are wanting to provide some GUI way of editing database tables, our MyEclipse for Spring product has scaffolding tools that can very quickly provide a base application for editing database tables, but I doubt that’s what you’re after.

    You might get more hints from a development forum, such as stackoverflow.com, rather than a specific product forum like this one.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Generate sourcecode for Pojo to Pojo mapping

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