Skip to content

Commit 074b880

Browse files
committed
slight simplification to SessionImpl.setProperty()
1 parent 69b7b8b commit 074b880

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,24 +2582,22 @@ public LockModeType getLockMode(Object entity) {
25822582
@Override
25832583
public void setProperty(String propertyName, Object value) {
25842584
checkOpen();
2585-
if ( value instanceof Serializable ) {
2586-
if ( propertyName != null ) {
2587-
// store property for future reference
2588-
if ( properties == null ) {
2589-
properties = getInitialProperties();
2590-
}
2591-
properties.put( propertyName, value );
2592-
// now actually update the setting if
2593-
// it's one that affects this Session
2594-
interpretProperty( propertyName, value );
2595-
}
2596-
else {
2597-
SESSION_LOGGER.nullPropertyKey();
2598-
}
2585+
if ( propertyName == null ) {
2586+
SESSION_LOGGER.nullPropertyKey();
25992587
}
2600-
else {
2588+
else if ( !(value instanceof Serializable) ) {
26012589
SESSION_LOGGER.nonSerializableProperty( propertyName );
26022590
}
2591+
else {
2592+
// store property for future reference
2593+
if ( properties == null ) {
2594+
properties = getInitialProperties();
2595+
}
2596+
properties.put( propertyName, value );
2597+
// now actually update the setting if
2598+
// it's one that affects this Session
2599+
interpretProperty( propertyName, value );
2600+
}
26032601
}
26042602

26052603
private void interpretProperty(String propertyName, Object value) {

0 commit comments

Comments
 (0)