-->
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: Inheritance or Different Architecture
PostPosted: Mon Feb 18, 2013 4:41 pm 
Newbie

Joined: Mon Feb 18, 2013 4:12 pm
Posts: 1
Hello,
Sorry for header, I could not find how I called my problem. I ll try to define what I want to create.
There will be a OriginalPlaneClasswhich will keep target values. For instance
Code:
public class OriginalPlaneClass{
private String targetLength;
private String targetcolor;
}

This targetLength will be saved and can not be changed never. (Users will enter this value too)

Then There will be a second class UserPlaneClass and users will enter actual data and this data will be kept in this class. For instance;
Code:
public class UserPlaneClass {
private String actualLength;
}


I will show to users target value and user will enter actual value. Then I will compare these values.
You can think it there will be master data, and actual data. The class two will contain all data of class one. A kind of copying class one. At the end there will be one OriginalPlaneClass and many UserPlaneClass.

What kind of structure do I need to set?

I did this, but I get LazyInitializationException while getting OriginalPlaneClass data from UserPlaneClass

Code:

class rootOne{
    private String targetvalue;
}

class rootOneCopy extends rootOne{

   private String actualValue;

   public rootOneCopy () {
    }

    public rootOneCopy (rootOne rootOne) {
        super(rootOne);
    }

}



and mapping

Code:
<class name="rootOne" table="rootOne">
        <id column="id" name="id" type="long">
            <generator class="increment"/>
        </id>
        <property column="targetvalue" length="2" name="targetvalue" not-null="true" type="integer" unique="false"/>
        <many-to-one class="model.Status" column="status" name="status" cascade="all" not-null="false"/>
    </class>
    <class name="rootOneCopy " table="rootOneCopy ">
        <id column="id" name="id" type="long">
            <generator class="increment"/>
        </id>
        <property column="targetvalue" length="2" name="targetvalue" not-null="true" type="integer" unique="false"/>
        <many-to-one class="model.Status" column="status" name="status" cascade="all" not-null="false"/>

        <property column="actualValue" length="2" name="actualValue" not-null="true" type="integer" unique="false"/>     
    </class>


What must be the architecture?


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.