@Override
public ExistedSystem getExistedSystemByName(String existedSystemName)
{
String hql = "select * from tbl_existed_system where name = {0}";
final String formathql = MessageFormat.format(hql, "'" + existedSystemName + "'");
ExistedSystem ret = (ExistedSystem)getHibernateTemplate().executeWithNewSession(new HibernateCallback()
{
@Override
public Object doInHibernate(Session session)
throws SQLException
{
ExistedSystem existedSystem = new ExistedSystem();
Object[] next = (Object[])session.createSQLQuery(formathql).uniqueResult();
Project project = new Project();
project.setProjectId((Integer)next[0]);
existedSystem.setProject(project);
existedSystem.setServerId((Integer)next[1]);
existedSystem.setName(next[Constants.TWO].toString());
existedSystem.setDescription(next[Constants.THREE].toString());
existedSystem.setModel(next[Constants.FOUR].toString());
existedSystem.setProcessorFamily(next[Constants.FIVE].toString());
existedSystem.setCpuCores((Short)next[Constants.SIX]);
existedSystem.setCpuCoreSpeed((Short)next[Constants.SEVEN]);
existedSystem.setMemoryCapacity((Float)next[Constants.EIGHT]);
existedSystem.setDiskIoCapacity((Float)next[Constants.NINE]);
existedSystem.setNetworkIoCapacity((Float)next[Constants.TEN]);
existedSystem.setOs(next[Constants.ELEVEN].toString());
existedSystem.setType((Short)next[Constants.TWELVE]);
return existedSystem;
}
});
return ret;
}
/** {@inheritDoc} */
public ExistedSystem getExistedSystemByName(String existedSystemName)
{
String hql = "select * from tbl_existed_system where name = {0}";
final String formathql = MessageFormat.format(hql, "'" + existedSystemName + "'");
ExistedSystem ret = (ExistedSystem)getHibernateTemplate().executeWithNewSession(new HibernateCallback()
{
@Override
public Object doInHibernate(Session session)
throws SQLException
{
ExistedSystem existedSystem = new ExistedSystem();
Object[] next = (Object[])session.createSQLQuery(formathql).uniqueResult();
Project project = new Project();
project.setProjectId((Integer)next[0]);
existedSystem.setProject(project);
existedSystem.setServerId((Integer)next[1]);
existedSystem.setName(next[Constants.TWO].toString());
existedSystem.setDescription(next[Constants.THREE].toString());
existedSystem.setModel(next[Constants.FOUR].toString());
existedSystem.setProcessorFamily(next[Constants.FIVE].toString());
existedSystem.setCpuCores((Short)next[Constants.SIX]);
existedSystem.setCpuCoreSpeed((Short)next[Constants.SEVEN]);
existedSystem.setMemoryCapacity((Float)next[Constants.EIGHT]);
existedSystem.setDiskIoCapacity((Float)next[Constants.NINE]);
existedSystem.setNetworkIoCapacity((Float)next[Constants.TEN]);
existedSystem.setOs(next[Constants.ELEVEN].toString());
existedSystem.setType((Short)next[Constants.TWELVE]);
return existedSystem;
}
});
return ret;
}
/** {@inheritDoc} */