facebook

Hibernate Reverse Engineering with Generic Sets

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #340117 Reply

    raydawg2000
    Participant

    It would be great for the reverse engineering process to generate generic variables

    for example

    private Set<MyObject>  objects= new HashSet<MyObject>(0); 

    instead of

    private Set  objects= new HashSet(0); 

    I am aware that this works when using Annotations, but that is not an option for us and this feature for XML Mapping support would be great.

    Thanks
    -Ray

    #340133 Reply

    support-swapna
    Moderator

    Ray,

    We already have an enhancement request filed. I will check with the team on the status and keep you posted.

    #340185 Reply

    Brian Fernandes
    Moderator

    Ray,

    Just to confirm your requirements, you want this sort of code to be generated when using .hbm.xml files and not annotations?

    #340621 Reply

    raydawg2000
    Participant

    Sorry for the delay, yes that is correct. We do not use annotations in our projects but we do use the .hbm.xml files for attribute mapping.

    Thanks

    #340622 Reply

    raydawg2000
    Participant

    Also to add to this, when MyEclipse generates the getters/setters for these attributes they should also have the generics for them as well

    public Set<MyObjects> getObjects() {..}
    public void setObjects(Set<MyObjects> objects) {..}

    for example

    #349461 Reply

    raydawg2000
    Participant

    Any more information available about this request?

    #349486 Reply

    Brian Fernandes
    Moderator

    Ray,

    Unfortunately no work has been done on this yet, but I have put this on the 2015 timeline. I’m not sure if will land for the EA release but pending unforeseen complications we should have it in for GA.

    #349499 Reply

    raydawg2000
    Participant

    Thanks for the update. Since the work on these issues hasn’t been addresses yet I will mention another thing. This may be implied as part of the rev-eng process but I’ll say it anyways.

    I mentioned the generated domain POJO classes in the original post, but this update I believe should also effect the hibernate DAO objects that are generated. Currently the class files have a bunch of generated methods like this

    
    public List findByProperty(String propertyName, Object value) {
            log.debug("finding AdjustmentType instance with property: "
                    + propertyName + ", value: " + value);
            try {
                String queryString = "from AdjustmentType as model where model."
                        + propertyName + "= ?";
                return getHibernateTemplate().find(queryString, value);
            } catch (RuntimeException re) {
                log.error("find by property name failed", re);
                throw re;
            }
        }
    
        public List findAll() {
            log.debug("finding all AdjustmentType instances");
            try {
                String queryString = "from AdjustmentType";
                return getHibernateTemplate().find(queryString);
            } catch (RuntimeException re) {
                log.error("find all failed", re);
                throw re;
            }
        }
    
    etc.....
    

    The return types on those generated methods should also have Generics declarations as well

    Thanks

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Hibernate Reverse Engineering with Generic Sets

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