jpenalver10 opened a new issue, #37595:
URL: https://github.com/apache/shardingsphere/issues/37595

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   5.5.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   The insert should be executed and commited successfully.
   
   ### Actual behavior
   
   An exception is thrown during the parsing phase:
   
   "org.apache.shardingsphere.sql.parser.exception.SQLParsingException: You 
have an error in your SQL syntax: no viable alternative at input 
'(filterid,filterValues_ORDER,field,values'"
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   JPA entities
   
   ```
   @Data
   @Entity
   @Table(name = "section_filters", schema = "my_schema")
   public class SectionFilterJPA {
   
       @Id
       private String id;    
   
       private String name;
   
       @ElementCollection
       @CollectionTable(schema = "my_schema", 
               name = "section_filtervalues",
               joinColumns = @JoinColumn(name = "filterid"))
       @OrderColumn
       private List<SectionFilterValuesJPA> filterValues = new ArrayList<>();
   
       // Constructors...
   }
   
   @Getter
   @NoArgsConstructor
   @Embeddable
   public class SectionFilterValuesJPA implements Serializable {
   
       private String field;
       private String values;
   
       public SectionFilterValuesJPA(String field, String values) {
           this.field = field;
           this.values = values;
       }
   }
   ```
   
   After the insert is executed on SectionFilterJPA, hibernate launch inserts 
in the embeddable entity section_filtervalues. When these inserts arrives to 
ShardingSphere an parsing error is thrown. Note that the ElementCollection has 
defined a column order with a default name generated by hibernate.
   
   ```
   Caused by: jakarta.persistence.RollbackException: Error while committing the 
transaction
        at 
org.hibernate.internal.ExceptionConverterImpl.convertCommitException(ExceptionConverterImpl.java:67)
        at 
org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:104)
        at 
org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:563)
        ... 28 common frames omitted
   Caused by: 
org.apache.shardingsphere.infra.exception.dialect.exception.syntax.sql.DialectSQLParsingException:
 You have an error in your SQL syntax: no viable alternative at input 
'(filterid,filterValues_ORDER,field,values'
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.getException(ShardingSphereSQLParserEngine.java:66)
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:59)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.parseSQL(ShardingSpherePreparedStatement.java:160)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:142)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:115)
        at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:108)
        at 
com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:328)
        at 
com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
   ```
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to