2016-04-16 57 views
-4
select tbl_LanguageData.Name As defaultLabel, 
     IsNull((Select Top 1 LanguageInfo From tbl_Language_TranslationInfo 
       Where tbl_Language_TranslationInfo.Languageid = 48 
       And tbl_Language_TranslationInfo.LanguageDataId = tbl_LanguageData.LanguageDataId), 
     tbl_LanguageData.Name) As localLang 
from tbl_UILabels, tbl_LanguageData 
Where tbl_UILabels.LanguageDataId = tbl_LanguageData.LanguageDataId 
    And menuid = 10100 

回答

0

寫在Hibernate中給定的查詢如果您已經(在庫META-INF文件的persistence.xml)定義持久性單元,則可以使用實體管理器和createNativeQuery方法

//declare the entity manager 

EntityManager em = Persistence.createEntityManagerFactory("name of your persistence unit").createEntityManager(); 

String request = "your request"; 

Result result = em.createNativeQuery(request,Result.class).getResultList();