私はLibertyプロジェクトで4.3.11を使用していますが、バージョン5で解決されたHibernateのバグがあります。WAS Liberty ProfileのJPAエンジンとしてHibernate 5を使用することは可能ですか
誰でもLiberty ProfileでHibernate 5.x.xを使用していますか? server.xmlのdataSourceライブラリにはどのようなジャーが含まれていますか?
おかげ
私はLibertyプロジェクトで4.3.11を使用していますが、バージョン5で解決されたHibernateのバグがあります。WAS Liberty ProfileのJPAエンジンとしてHibernate 5を使用することは可能ですか
誰でもLiberty ProfileでHibernate 5.x.xを使用していますか? server.xmlのdataSourceライブラリにはどのようなジャーが含まれていますか?
おかげ
私はこれらのJAR含まれている場合、私は、少なくとも部分的に自由で働い5.xの休止状態を取得することができました:
<library id="hibernate">
<file name="${server.config.dir}/hibernate/antlr-2.7.7.jar"/>
<file name="${server.config.dir}/hibernate/classmate-1.3.0.jar"/>
<file name="${server.config.dir}/hibernate/dom4j-1.6.1.jar"/>
<file name="${server.config.dir}/hibernate/hibernate-commons-annotations-5.0.1.Final.jar"/>
<file name="${server.config.dir}/hibernate/hibernate-core-5.2.6.Final.jar"/>
<file name="${server.config.dir}/hibernate/javassist-3.20.0-GA.jar"/>
<file name="${server.config.dir}/hibernate/jboss-logging-3.3.0.Final.jar"/>
</library>
<application location="myApp.war">
<classloader commonLibraryRef="hibernate"/>
</application>
私は部分的に作業を言う理由は、それが素晴らしい作品ということですnon-jta-data-sourceを使用していても、jta-data-sourceを使用しようとしている場合、Hibernateはベンダー固有のAPIの検索に失敗して、現在のトランザクションを中断できます。 Hibernateには、WebSphereサーバーで使用されていることを伝えるために設定できるプロパティがいくつかありますが、jta-data-sourceの結果がうまくいかなかったものをさまざまに組み合わせて調べました。私は、Hibernateの実装ではLibertyの意識が欠けていると思います。これは本当に追加する必要があるものです(HHH-10388を参照してください。貴重なものがあれば投票してください)。 com.ibm.tx.jta.TransactionManagerFactoryに委譲して永続性プロパティとして指定するHibernate JtaPlatformの実装です。
package example;
import com.ibm.tx.jta.TransactionManagerFactory;
import javax.naming.*;
import javax.transaction.*;
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
public class WebSphereLibertyJtaPlatform implements JtaPlatform {
public boolean canRegisterSynchronization() {
try {
return getCurrentStatus() == Status.STATUS_ACTIVE;
} catch (SystemException x) {
throw new RuntimeException(x);
}
}
public int getCurrentStatus() throws SystemException {
return retrieveTransactionManager().getStatus();
}
public Object getTransactionIdentifier(Transaction transaction) {
return transaction;
}
public void registerSynchronization(Synchronization synchronization) {
try {
retrieveTransactionManager().getTransaction().registerSynchronization(synchronization);
} catch (IllegalStateException x) {
throw new RuntimeException(x);
} catch (RollbackException x) {
throw new RuntimeException(x);
} catch (SystemException x) {
throw new RuntimeException(x);
}
}
public TransactionManager retrieveTransactionManager() {
return TransactionManagerFactory.getTransactionManager();
}
public UserTransaction retrieveUserTransaction() {
try {
return InitialContext.doLookup("java:comp/UserTransaction");
} catch (NamingException x) {
throw new RuntimeException(x);
}
}
}
ご返信ありがとうございます。残念ながら、私はJTAデータソースが必要です。 (私はすでにorg.hibernate.jpa.HibernatePersistenceProviderを使用しています...私は常にpersistence.xmlにそれを含めたと思う)...あまりにも悪い。私はこれが私にJBossに戻るように強制しないことを願っています... – icordoba
persistence.xmlで例えば
、<persistence-unit ...
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
...
<properties>
<property name="hibernate.transaction.jta.platform"
value="example.WebSphereLibertyJtaPlatform" />
</properties>
</persistence-unit>
例の実装では、自分でも似たような状況になってしまいました。 例外メッセージは次のとおりです。com.ibm.ws.container.service.state.StateChangeException:javax.xml.stream.FactoryConfigurationError:プロバイダjavax.xml.stream.XMLEventFactoryをインスタンス化できませんでした:java.util.ServiceConfigurationError:javax.xml .stream.XMLEventFactory:プロバイダーcom.ibm.xml.xlxp2.api.stax.XMLEventFactoryImplが見つかりません
突破口がありますか?
私は休止状態に固執しました4 :-( – icordoba
私はアプリケーションサーバーを起動したとき、私は、彼らが
com.ibm.ws.jpa.hibernate.LibertyJtaPlatform
、今、このクラスを導入しているコンテナに気づいたスレッドが少し古いですけど、リバティプロフィール17.0.0.2と17.0.0.3を比較
:データ・ソースのための休止状態を初期化する
HibernatePersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo info, Map properties)
を呼び出し、プロパティで、あなたがそのクラスのインスタンスを持っていたときに、いくつかのプロパティを渡します
希望します。
LIberty(Eclipse Link)で提供されているJPAの使用を検討する必要があります。 – Gas
私はすでに試しましたが、Hibernateでコーディングするのは長年のことです。数年前、私は試してみましたが、EclipseLinkはクエリにあまりに多くの警告と問題を示しました。残念ながら、厳密にJPAに従おうとしても、コードを変更せずにJPAエンジンを変更するだけでは、マイナーな違いが多すぎます。たぶん、もう一度やり直す時間です。 – icordoba