facebook

Keys for hibernate classes

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

    Nic Holbrook
    Member

    Is there a way to have a Key class generated for all the hibernate classes? I know they are generated for the composite-id classes but I have so much data and work with detatched sessions so I like to load keys instead of whole classes for relationships much of the time.

    #229382 Reply

    Riyad Kalla
    Member

    I will ask the Hibernate dev.

    #229393 Reply

    support-jeff
    Member

    Not currently, and there are no plans to support this scenario (unless enough people ask for it!). It is not a common use case. However, with the changes coming down the line, you will be able to more easily alter the mappings after they are generated to support the kind of thing you want.

    #229411 Reply

    Nic Holbrook
    Member

    @support-jeff wrote:

    Not currently, and there are no plans to support this scenario (unless enough people ask for it!). It is not a common use case. However, with the changes coming down the line, you will be able to more easily alter the mappings after they are generated to support the kind of thing you want.

    One of the reasons I like keys for everything is that I just load the full object and the data footprint is very small. I can basically lazy load across disconnected sessions. The way I do this is have all my hibernated objects extend a BaseKey class. What this allows me to do is implement some standard crud methods for all of my dto’s and not worry about having dao’s for all of them which can be very helpful if you have a lot of objects and don’t want to implement a lot of extra code. All my dao’s extend a base dao with a findByPrimaryKey(BaseKey key), find(BaseKey[] keys), delete(BaseKey key), etc. This gives me a more general way of working with all my data.

    Anyway, thanks for checking.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Keys for hibernate classes

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