facebook

Problem generating Hibernate mapping on a view

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

    retoinform
    Member

    I am having a problem with the generated classes and the mapping file for a database view on a MSSQL DB. We use the views only to read data, so there are not necessarily unique ID’s. I select “Java Type” and ID generator “identity”, and do not select composite ID generation. But what comes out are 2 classes with identical and empty “default constructor” and “full constructor”, which do not compile, and an ID class with all the properties which I would expect in the other 2 classes. Furthermore the hibernate-mapping file has only a composite-id, and no properties.
    Can anyone help me, what I am doing wrong, or is it a mapping generator bug?
    I am using Eclipse 3.1.2, MyEclipse 4.1

    #246684 Reply

    Riyad Kalla
    Member

    so there are not necessarily unique ID’s.

    This is going to be a problem as hibernate mapped classes require IDs to uniquely identify the records.

    #246714 Reply

    Haris Peco
    Member

    retoinform,

    Hibernate require ID for persistent class (and relational database rows have to be unique in theory).
    It isn’t possible set ID for view (except all columns/properties) because view haven’t primary key – it is preferable for view mapping.However, if you have duplicate rows (all column same) hibernate will not what you expect.

    What mapping you expect ?

    Best

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Problem generating Hibernate mapping on a view

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