forked from hibernate/hibernate-reactive
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hibernate#1732] Fix to support array Types
- Loading branch information
Showing
7 changed files
with
307 additions
and
26 deletions.
There are no files selected for viewing
88 changes: 88 additions & 0 deletions
88
hibernate-reactive-core/src/main/java/org/hibernate/reactive/adaptor/impl/ArrayAdaptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright: Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.reactive.adaptor.impl; | ||
|
||
import java.sql.Array; | ||
import java.sql.ResultSet; | ||
import java.util.Map; | ||
|
||
import org.hibernate.type.descriptor.jdbc.JdbcType; | ||
|
||
public class ArrayAdaptor implements Array { | ||
|
||
private final String baseTypeName; | ||
private final int jdbcTypeCode; | ||
private Object[] objects; | ||
|
||
public ArrayAdaptor(JdbcType elementJdbcType, Object[] objects) { | ||
this( elementJdbcType.getFriendlyName(), elementJdbcType.getJdbcTypeCode(), objects ); | ||
} | ||
|
||
public ArrayAdaptor(String baseTypeName, Object[] objects) { | ||
this( baseTypeName, 0, objects ); | ||
} | ||
|
||
private ArrayAdaptor(String baseTypeName, int jdbcTypeCode, Object[] objects) { | ||
this.baseTypeName = baseTypeName; | ||
this.jdbcTypeCode = jdbcTypeCode; | ||
this.objects = objects; | ||
} | ||
|
||
@Override | ||
public String getBaseTypeName() { | ||
return baseTypeName; | ||
} | ||
|
||
@Override | ||
public int getBaseType() { | ||
return jdbcTypeCode; | ||
} | ||
|
||
@Override | ||
public Object getArray() { | ||
return objects; | ||
} | ||
|
||
@Override | ||
public Object getArray(Map<String, Class<?>> map) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public Object getArray(long index, int count) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public Object getArray(long index, int count, Map<String, Class<?>> map) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public ResultSet getResultSet() { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public ResultSet getResultSet(Map<String, Class<?>> map) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public ResultSet getResultSet(long index, int count) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) { | ||
throw new UnsupportedOperationException( "array of maps is not yet supported" ); | ||
} | ||
|
||
@Override | ||
public void free() { | ||
objects = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.