从hibernate查询填充hashmap

时间:2017-02-02 09:55:13

标签: java hibernate hashmap hibernate-mapping

public List<UMRDTO> getDocumentLink(Session session)

{
    List<UMRDTO> documentationList = null;

        Query query = null;
        query = session.createQuery(UMRSQLInt.DOCUMENTATION_LIST);
        documentationList = query.list();


    return documentationList;

}

每当我重新启动我的应用程序时,所有的hashmap都是空的,并且没有数据存在于之前的输入中

我需要从上面的查询中获取列表,即objectName,objectType和documentationLink,然后将数据(objectName,documentationLink)放入HashMap中,如果objectName是Domainname,那么数据将被放入domainDocumentationMap中,或者如果是combo然后在domainComboDocumentationMap

private static Map<String, String> domainDocumentationMap = null;
private static Map<String, String> domainComboDocumentationMap = null;

static
{
    domainDocumentationMap = new HashMap<String, String>();
    domainComboDocumentationMap = new HashMap<String, String>();

}

public static Map<String, String>  getDomainDocumentationMap(){
    return domainDocumentationMap;
}

public static void setDomainDocumentationMap(String objectName, String documentationLink) {
    MMTUtil.domainDocumentationMap.put(objectName, documentationLink);

    }

我应该写什么查询?

0 个答案:

没有答案