Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blaze subView with constructor compilation error #1994

Open
mahairod opened this issue Feb 11, 2025 · 1 comment
Open

Blaze subView with constructor compilation error #1994

mahairod opened this issue Feb 11, 2025 · 1 comment

Comments

@mahairod
Copy link

Let's say we have such case:

      @EntityView(Validation.class)
      public interface ValidationView extends IValidation {
          @Override
          @Mapping("this")
          TimePeriodForValidation getPeriod();
      
          @EntityView(Validation.class)
          abstract class TimePeriodForValidation extends TimePeriodView {
              public TimePeriodForValidation(
                      @Mapping("startTime") LocalDateTime startTime,
                      @Mapping("endTime") LocalDateTime endTime
              ) {
                  super(startTime, endTime);
              }
          }
      }

With com.blazebit:blaze-persistence-integration-quarkus-3 it gives me a

RuntimeException: Probably we did something wrong, please contact us if you see this message.

which is caused by compile error (at runtime), when it tries to call constructor of TimePeriodForValidation with strange paramters: TimePeriodForValidation_$$javassist_entityview and Map. TimePeriodForValidation_$$javassist_entityview is probably derived from TimePeriodForValidation

Caused by: javassist.CannotCompileException: [source error] cannot find constructor ru.elliptica.webid.jpa.view.ValidationView$TimePeriodForValidation_$$_javassist_entityview_(ru.elliptica.webid.jpa.view.ValidationView$TimePeriodForValidation_$$_javassist_entityview_,java.util.Map)                                                                                                
        at javassist.CtBehavior.setBody(CtBehavior.java:474)                                                                                                                                 
        at javassist.CtBehavior.setBody(CtBehavior.java:440)                                                                                                                                 
        at javassist.CtConstructor.setBody(CtConstructor.java:228)                                                                                                                           
        at com.blazebit.persistence.view.impl.proxy.ProxyFactory.finishConstructorWithPostConstruct(ProxyFactory.java:2532)                                                                  
        at com.blazebit.persistence.view.impl.proxy.ProxyFactory.createConstructor(ProxyFactory.java:2437)                                                                                   
        at com.blazebit.persistence.view.impl.proxy.ProxyFactory.createCreateConstructor(ProxyFactory.java:2395)                                                                             
        at com.blazebit.persistence.view.impl.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:588)                                                                                     ```

NB. startTime and endTime are fields of Validation.class

Seems like it only happens when ConstructorKind is ProxyFactory.ConstructorKind.CREATE
@beikov
Copy link
Member

beikov commented Feb 13, 2025

Thanks for reporting. Can you confirm that adding a no-arg constructor like I suggested on the SO post is a viable workaround?

I.e. add

@ViewConstructor("create")
public TimePeriodForValidation() {
    super(null, null);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants