Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Customizer for VARRAY column
Customizer for VARRAY column [message #1854831] Tue, 13 September 2022 18:44 Go to next message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 36
Registered: July 2009
Member
I have a VARRAY type defined as

create or replace TYPE STORAGE_DIRECTIVES AS VARRAY(10) OF varchar2(255 char);

and a table using such as

CREATE TABLE "FSS_CLOB_VIEW"
( "LOB_ID" NUMBER(18,0),
"FILE_NAME" VARCHAR2(255 CHAR),
"DIRECTIVES" "STORAGE_DIRECTIVES" ,
"LOB_DATA" CLOB,
) ;

Trying to map that to a List<String> in jpa, such as

@Override
@Column(name = "DIRECTIVES", nullable = true, unique = false)
public List<String> getDirectives() {
return directives;
}

Now i assume i need to add a
@Customizer(StorageDirectivesCustomizer.class)
to this entity,which i have done,and the customizer looks like

public class StorageDirectivesCustomizer implements DescriptorCustomizer {

@Override
public void customize(ClassDescriptor descriptor) throws Exception {
ObjectArrayMapping arrayMapping = new ObjectArrayMapping();

arrayMapping.setReferenceClass(String.class);
arrayMapping.setAttributeName("directives");
arrayMapping.setFieldName("directives");
arrayMapping.setStructureName("STORAGE_DIRECTIVES");

descriptor.addMapping(arrayMapping);
}
}

However when i run, i get

[java] Exception Description: Descriptor is missing for class [java.lang.String].
[java] Mapping: org.eclipse.persistence.mappings.structures.ObjectArrayMapping[directives]
[java] Descriptor: RelationalDescriptor(com.oracle.cegbu.filestore.extschema.jpa.entity.DatabaseStorageClobTableEO --> [DatabaseTable(FSS_CLOB_VIEW)])


Can someone enlighten me on what i'm doing wrong?
Re: Customizer for VARRAY column [message #1854842 is a reply to message #1854831] Wed, 14 September 2022 07:09 Go to previous messageGo to next message
Radek Felcman is currently offline Radek FelcmanFriend
Messages: 22
Registered: March 2021
Junior Member
Hello,

I don't think, that
@Customizer
is needed.
Please check
documentation
https://www.eclipse.org/eclipselink/api/2.7/org/eclipse/persistence/annotations/Array.html
and some example (EclipseLink JUnit Test)
https://github.com/eclipse-ee4j/eclipselink/blob/master/jpa/eclipselink.jpa.testapps.oracle/jpa.test.oracle.plsql/src/main/java/org/eclipse/persistence/testing/models/jpa/plsql/Consultant.java#L46-L49
https://github.com/eclipse-ee4j/eclipselink/blob/master/jpa/eclipselink.jpa.testapps.oracle/jpa.test.oracle.plsql/src/test/java/org/eclipse/persistence/testing/tests/jpa/plsql/PLSQLTest.java#L160
Re: Customizer for VARRAY column [message #1854850 is a reply to message #1854842] Wed, 14 September 2022 14:01 Go to previous messageGo to next message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 36
Registered: July 2009
Member
Thanks for the response, when i annotate the getter, like

    @Override
    @org.eclipse.persistence.annotations.Array(targetClass = String.class, databaseType = "STORAGE_DIRECTIVES")
    @Column(name = "DIRECTIVES", nullable = true, unique = false)
    public List<String> getDirectives() {
        return directives;
    }


i get the exception

[java] Caused by: org.eclipse.persistence.exceptions.DescriptorException:
[java] Exception Description: Normal descriptors do not support non-relational extensions.
[java] Descriptor: RelationalDescriptor(com.oracle.cegbu.filestore.extschema.jpa.entity.DatabaseStorageClobTableEO --> [DatabaseTable(FSS_CLOB_VIEW)])

I see in the supplied examples, it is applied to the field, so when i move to

    @org.eclipse.persistence.annotations.Array(targetClass = String.class, databaseType = "STORAGE_DIRECTIVES")
    @Column(name = "DIRECTIVES", nullable = true, unique = false)
    private List<String> directives;


i get the exception

[java] Caused by: java.sql.SQLException: ORA-00600: internal error code, arguments: [xtyDSTprimsec], [], [], [], [], [], [], [], [], [], [], []

[Updated on: Wed, 14 September 2022 14:45]

Report message to a moderator

Re: Customizer for VARRAY column [message #1855153 is a reply to message #1854850] Thu, 29 September 2022 21:44 Go to previous message
Dave Brosius is currently offline Dave BrosiusFriend
Messages: 36
Registered: July 2009
Member
I decided to use raw jdbc by unwrap()ing the connection, and it works fine. so i guess i'm good.
Previous Topic:@ManagedInterface to eclipselink specific code
Next Topic:Problem with circular references
Goto Forum:
  


Current Time: Thu Dec 26 21:45:04 GMT 2024

Powered by FUDForum. Page generated in 0.03343 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top