Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.3, 4.3.0.Beta4
    • Component/s: build
    • Labels:
    • Last commented by a user?:
      true

      Description

      This task, and sub-tasks, will address Hibernate ORM in OSGi environments.

      Use cases and design ideas are available in this wiki:
      https://github.com/hibernate/hibernate-orm/wiki/Proposal:-OSGi

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              brmeyer Brett Meyer added a comment -

              Just be aware that most of the current caveats with hibernate-osgi are due to shortcomings in the static Hibernate architecture, not misunderstandings of OSGi best practices

              Show
              brmeyer Brett Meyer added a comment - Just be aware that most of the current caveats with hibernate-osgi are due to shortcomings in the static Hibernate architecture, not misunderstandings of OSGi best practices
              Hide
              degaia De Gaia added a comment -

              Brett I'm not putting your competencies on the line her but i think that if we haVe the grand father of OSGi backing you it won't be neglectable at all !!!!

              Show
              degaia De Gaia added a comment - Brett I'm not putting your competencies on the line her but i think that if we haVe the grand father of OSGi backing you it won't be neglectable at all !!!!
              Hide
              ffang Freeman Fang added a comment -

              Hi Brett,

              I noticed that in org.hibernate.osgi.OsgiJtaPlatform, there are code like

              @Override
                      public boolean canRegisterSynchronization() {
                              // TODO
                              return false;
                      }
              
                      @Override
                      public void registerSynchronization(Synchronization synchronization) {
                              // TODO
                      }
              

              And also looked at the code at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.attemptToRegisterJtaSync()

                              jtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();//the jtaPlatform in OSGi container is instance of      org.hibernate.osgi.OsgiJtaPlatform
              		if ( jtaPlatform == null ) {
              			// if no jta platform was registered we wont be able to register a jta synchronization
              			return;
              		}
              
              		// Can we resister a synchronization
              		if ( !jtaPlatform.canRegisterSynchronization() ) {
              			LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
              			return;// always return here in OSGi container like karaf
              		}
              

              So this can cause no hibernate Synchronization impl get registered in JTA service when in OSGi container, which means when use Container Managed Transaction, when TransactionImpl(org.apache.geronimo.transaction.manager.TransactionImpl) commit, it's not possible to trigger Synchronization impl callback in hibernate, when means can't invoke the hibernate SessionImpl.flush method, so we run into the problem that the actual data not get flushed before transaction complete/commit.

              So my question is when could canRegisterSynchronization/registerSynchronization method could get implemented in org.hibernate.osgi.OsgiJtaPlatform? As with current implementation the transaction actually doesn't work in OSGi container.

              Do I miss something? Is there any workaround for it?

              Thanks for all your hard work in hibernate-osgi support!
              Best Regards
              Freeman

              Show
              ffang Freeman Fang added a comment - Hi Brett, I noticed that in org.hibernate.osgi.OsgiJtaPlatform, there are code like @Override public boolean canRegisterSynchronization() { // TODO return false ; } @Override public void registerSynchronization(Synchronization synchronization) { // TODO } And also looked at the code at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.attemptToRegisterJtaSync() jtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform(); //the jtaPlatform in OSGi container is instance of org.hibernate.osgi.OsgiJtaPlatform if ( jtaPlatform == null ) { // if no jta platform was registered we wont be able to register a jta synchronization return ; } // Can we resister a synchronization if ( !jtaPlatform.canRegisterSynchronization() ) { LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" ); return ; // always return here in OSGi container like karaf } So this can cause no hibernate Synchronization impl get registered in JTA service when in OSGi container, which means when use Container Managed Transaction, when TransactionImpl(org.apache.geronimo.transaction.manager.TransactionImpl) commit, it's not possible to trigger Synchronization impl callback in hibernate, when means can't invoke the hibernate SessionImpl.flush method, so we run into the problem that the actual data not get flushed before transaction complete/commit. So my question is when could canRegisterSynchronization/registerSynchronization method could get implemented in org.hibernate.osgi.OsgiJtaPlatform? As with current implementation the transaction actually doesn't work in OSGi container. Do I miss something? Is there any workaround for it? Thanks for all your hard work in hibernate-osgi support! Best Regards Freeman
              Hide
              brmeyer Brett Meyer added a comment -

              Freeman Fang, great catch – that was just an oversight on my part. Following up with HHH-8633

              Show
              brmeyer Brett Meyer added a comment - Freeman Fang , great catch – that was just an oversight on my part. Following up with HHH-8633
              Hide
              degaia De Gaia added a comment -

              Hi Brett, after having a discussion with Peter Kriens i posted on the next ticket the link for his JPA tutorial with OSGi and Hibernate

              https://hibernate.atlassian.net/browse/HHH-8501

              You can maybe check somethings are usefull for you.
              Have a great day

              Show
              degaia De Gaia added a comment - Hi Brett, after having a discussion with Peter Kriens i posted on the next ticket the link for his JPA tutorial with OSGi and Hibernate https://hibernate.atlassian.net/browse/HHH-8501 You can maybe check somethings are usefull for you. Have a great day

                People

                • Votes:
                  10 Vote for this issue
                  Watchers:
                  26 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 1.55h
                    1.55h

                      Development