26
26
import java .util .Collections ;
27
27
import java .util .List ;
28
28
import java .util .Map ;
29
+
29
30
import javax .ejb .EJBException ;
30
31
import javax .transaction .RollbackException ;
31
32
import javax .transaction .Synchronization ;
32
33
import javax .transaction .SystemException ;
33
34
import javax .transaction .Transaction ;
34
35
import javax .transaction .TransactionManager ;
35
- import static org . jboss . as . cmp . CmpMessages . MESSAGES ;
36
+
36
37
import org .jboss .as .cmp .component .CmpEntityBeanComponent ;
37
38
import org .jboss .as .cmp .context .CmpEntityBeanContext ;
38
39
import org .jboss .logging .Logger ;
45
46
import org .jboss .tm .TransactionLocal ;
46
47
import org .jboss .tm .TxUtils ;
47
48
49
+ import static org .jboss .as .cmp .CmpMessages .MESSAGES ;
50
+
48
51
/**
49
52
* @author John Bailey
50
53
*/
@@ -140,7 +143,7 @@ public void scheduleSync(Transaction tx, CmpEntityBeanContext context) {
140
143
}
141
144
142
145
public void invokeEjbStore (Thread thread , CmpEntityBeanContext context ) throws Exception {
143
- if (!context .isRemoved () && context .getPrimaryKey () != null ) {
146
+ if (!context .isRemoved () && context .getPrimaryKeyUnchecked () != null ) {
144
147
CmpEntityBeanComponent container = context .getComponent ();
145
148
// set the context class loader before calling the store method
146
149
container .invokeEjbStore (context );
@@ -150,7 +153,7 @@ public void invokeEjbStore(Thread thread, CmpEntityBeanContext context) throws E
150
153
public void synchronize (Thread thread , Transaction tx , CmpEntityBeanContext context ) throws Exception {
151
154
// only synchronize if the id is not null. A null id means
152
155
// that the entity has been removed.
153
- if (!context .isRemoved () && context .getPrimaryKey () != null ) {
156
+ if (!context .isRemoved () && context .getPrimaryKeyUnchecked () != null ) {
154
157
CmpEntityBeanComponent container = context .getComponent ();
155
158
156
159
// set the context class loader before calling the store method
@@ -180,7 +183,7 @@ public void scheduleSync(Transaction tx, CmpEntityBeanContext context) {
180
183
public void synchronize (Thread thread , Transaction tx , CmpEntityBeanContext context ) throws Exception {
181
184
CmpEntityBeanComponent container = context .getComponent ();
182
185
if (container .getStoreManager ().isStoreRequired (context )) {
183
- throw MESSAGES .instanceEvictedBeforeSync (container .getComponentName (), context .getPrimaryKey ());
186
+ throw MESSAGES .instanceEvictedBeforeSync (container .getComponentName (), context .getPrimaryKeyUnchecked ());
184
187
}
185
188
}
186
189
@@ -314,7 +317,7 @@ public void synchronize() {
314
317
if (causeByException instanceof EJBException ) {
315
318
throw (EJBException ) causeByException ;
316
319
}
317
- throw CmpMessages .MESSAGES .failedToStoreEntity (((context == null || context .getPrimaryKey () == null ) ? "<null>" : context .getPrimaryKey ().toString ()), causeByException );
320
+ throw CmpMessages .MESSAGES .failedToStoreEntity (((context == null || context .getPrimaryKeyUnchecked () == null ) ? "<null>" : context .getPrimaryKeyUnchecked ().toString ()), causeByException );
318
321
} finally {
319
322
synchronizing = false ;
320
323
}
0 commit comments