-->
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: how to use subselect annotation to define view entity class
PostPosted: Tue Jan 29, 2013 5:49 am 
Newbie

Joined: Tue Jan 29, 2013 5:33 am
Posts: 4
Hi experts,
I want to define a readonly view entity class. Thats why I have written like following class. But according to jars which are used for the project does not contain Subselect and Synchronize annotation class. In order to achieve this issue i tried to change some jars with old ones. But occured another incompatible exceptions. I'd learn strongly if which compatible jar list includes org.hibernate.annotations.Subselect.class

Developed in ADF platform and Weblogic 10.3
Using these hibernate releases:
hibernate3.jar
hibernate-annotations-3.4.0.GA.jar
hibernate-commons-annotations-3.3.0.ga.jar
hibernate-entitymanager-3.4.0.GA.jar
hibernate-validator-4.1.0.Final.jar
This composition was enough and useful for me until required of using Subselect annotation class

Plz help me
Thanks in advance
Brgds

import com.arsivist.structure.BaseEntityView;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import org.hibernate.annotations.Immutable;
import org.hibernate.annotations.Subselect;
import org.hibernate.annotations.Synchronize;


@Entity(name = "IntegrationDepartment")
@Immutable
@Subselect("SELECT * FROM DEPARTMENTVIEW")
@Synchronize("DEPARTMENTVIEW")
public class IntegrationDepartment extends BaseEntityView
{
private IntegrationDepartment dependentDepartment;
private String code;
private String name;
private int departmentLevel;
private boolean excludeDistribution;

private Collection<IntegrationDepartment> departmentList;

public IntegrationDepartment()
{
entityName = "IntegrationDepartment";
departmentList = new ArrayList<IntegrationDepartment>();
}

public IntegrationDepartment(int id, String code)
{
entityName = "IntegrationDepartment";
departmentList = new ArrayList<IntegrationDepartment>();

this.id = id;
this.code = code;
}

@Id
@Column(name = "ID")
public int getId()
{
return id;
}

public void setId(int id)
{
this.id = id;
}

public void setDependentDepartment(IntegrationDepartment dependentDepartment)
{
this.dependentDepartment = dependentDepartment;
}

@ManyToOne(targetEntity = com.roketsan.integrationmodel.entity.IntegrationDepartment.class)
@JoinColumn(name = "DEPENDENTDEPARTMENTID")
public IntegrationDepartment getDependentDepartment()
{
return dependentDepartment;
}

public void setCode(String code)
{
this.code = code;
}

@Column(name = "CODE")
public String getCode()
{
return code;
}

public void setName(String name)
{
this.name = name;
}

@Column(name = "NAME")
public String getName()
{
return name;
}

public void setDepartmentLevel(int departmentLevel)
{
this.departmentLevel = departmentLevel;
}

@Column(name = "DEPARTMENTLEVEL")
public int getDepartmentLevel()
{
return departmentLevel;
}

public void setDepartmentList(Collection<IntegrationDepartment> departmentList)
{
this.departmentList = departmentList;
}

@OneToMany(mappedBy = "dependentDepartment")
@JoinColumn(name = "DEPENDENTDEPARTMENTID")
public Collection<IntegrationDepartment> getDepartmentList()
{
return departmentList;
}

public void setExcludeDistribution(boolean excludeDistribution)
{
this.excludeDistribution = excludeDistribution;
}

@Column(name = "EXCLUDEDISTRIBUTION")
public boolean isExcludeDistribution()
{
return excludeDistribution;
}

@Override
@Transient
public int compareTo(Object object)
{
if (!(object instanceof BaseEntityView))
throw new ClassCastException();

IntegrationDepartment baseEntity = (IntegrationDepartment)object;
Integer comparableElementA = getDepartmentLevel();
Integer comparableElementB = baseEntity.getDepartmentLevel();

return comparableElementA.compareTo(comparableElementB);
}

public String toString()
{
return "" + getCode();
}
}


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.