On 16/02/24 19:36, GCHQDeveloper29 wrote:
Hi Francesco,

Thank you for your timely response.
I have tried to insert the following snippet into my spring-orm.xml file (before the 
</entity-mappings> and after the </entity> for 
"org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrUniqueValue", however it 
still appears to be creating as a VARCHAR(255) on postgresql as if the overrides are being ignored - 
if I have been a fool please do let me know.

<entity 
class="org.apache.syncope.core.persistence.jpa.entity.anyobject.JPAAPlainAttrValue">
   <attributes>
     <basic name="stringValue">
       <column column-definition="text" />
     </basic>
   </attributes>
</entity>

<entity 
class="org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue">
   <attributes>
     <basic name="stringValue">
       <column column-definition="text" />
     </basic>
   </attributes>
</entity>

<entity 
class="org.apache.syncope.core.persistence.jpa.entity.group.JPAGPlainAttrValue">
   <attributes>
     <basic name="stringValue">
       <column column-definition="text" />
     </basic>
   </attributes>
</entity>

Hi,
as you have correctly reported before, the column whose mapping you want to 
change is declared as field in AbstractPlainAttrValue, so you need to add 
something like:

  <mapped-superclass 
class="org.apache.syncope.core.persistence.jpa.entity.AbstractPlainAttrValue">
    <attributes>
      <basic name="stringValue">
        <column column-definition="text"/>
      </basic>
    </attributes>
  </mapped-superclass>

right before the first <entity/> element in the file (see the declared XSD for 
more information).

As already said, please double check which ORM file you are effectively using: 
there are different ones in fact for:

* PostgreSQL with JSONB support
* MySQL with JSON support
* Oracle, default or with JSON support
* SQL server

if you are not in any of these 4 cases, then the default spring-orm.xml will 
apply.

HTH
Regards.

On Friday, 16 February 2024 at 14:49, Francesco Chicchiriccò 
<ilgro...@apache.org> wrote:

On 16/02/24 15:40, GCHQDeveloper29 wrote:

Currently, string value'd schema are limited to 255 characters in length due to 
OpenJPA defaults.
It would be beneficial to either have this length as adjustable, increased or 
converted to a Lob.
The relevant code is within 
core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractPlainAttrValue.java

Hi,
you should be able to tweak any column definition by adjusting your local ORM 
file.
The actual file to change is the one indicated by the

persistence.domain[0].orm

property, e.g. spring-orm.xml by default.

The OpenJPA settings will in fact get metadata definitions both from Java 
annotations (which are in fact immutable) and ORM xml file, with the latter 
taking precedence over the former.

HTH
Regards.

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Reply via email to