-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Create object in relation through factory
PostPosted: Thu Jul 14, 2011 3:42 am 
Newbie

Joined: Thu Jul 14, 2011 3:32 am
Posts: 1
Hi,
I'm new to Hibernate and I'm trying to achieve the following: the class i'm working with is persistent and is stored in DB. It looks like this:
Code:
class Card {
  private int id;
  private int CardPrototype prototype;
  ...
};

and has all needed getters and setters and annotations for persistence. Class Card is stored in DB table like this
Code:
CREATE TABLE Card (
  id SERIAL NOT NULL,
  prototype CHAR(85) NOT NULL,
  ...
)

The class in relation is CardPrototype, it is identified by a string identifier, and it is not stored in database at all. However, I have a factory class with non-static method
Code:
CardPrototype getPrototype (final String id)

which I want to use to resolve Card.prototype field during ORM object loading. Could you please help me to achieve this with Hibernate?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.