Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Francisco Eguiguren
    @feguiguren

    new error now:

    java.lang.NoSuchMethodError: 'java.util.stream.Stream javax.persistence.TypedQuery.getResultStream()'

    (Apologies for polluting the chat with my progress, will stop )
    Francisco Eguiguren
    @feguiguren

    now I have a jpa streamer question:

    [warn] Could not determine source for class models.User$

    This is how my user class looks like

    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    @Builder
    @EqualsAndHashCode(callSuper = false)
    @Entity(name = "user")
    public class User implements Record {
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
    
      private String name;
    }
    am I missing something?
    Francisco Eguiguren
    @feguiguren
    also, when I try to filter by using 'User$', my IDE cannot find that class (nor command line). So my guess that source is not being generated
    Also this message draws my attention
    [warn] Supported source version 'RELEASE_8' from annotation processor 'com.speedment.jpastreamer.fieldgenerator.StandardFieldGeneratorProcessor' less than -source '11'
    Francisco Eguiguren
    @feguiguren
    mmm the class actually gets generated, I can see it on the /target folder. But it's not available at compile time. Both .class and .java files are on /target.
    Per-Åke Minborg
    @minborg
    In IDEA, you can mark the generated sources, right-click and "Mark directory as”->”Generated source root"
    There is also an additional maven trick to solve the problem as described here: https://speedment.github.io/jpa-streamer/jpa-streamer/1.0.1/quick-start/quick-start.html
    Per-Åke Minborg
    @minborg
    Did it work out with Akka @feguiguren ?
    Francisco Eguiguren
    @feguiguren
    kind of. So the thing is that as the files gets generated on the target/ directory, the default process (sbt clean update compile) removes the generated files, then compiles -- where models get generated -- but it's too late for sbt to pick it up.
    So if I do 'sbt clean update compile' and then sbt compile, I have the models as part of my source
    Francisco Eguiguren
    @feguiguren
    also, it looks like annotation processors are executed after compiling java sources
    still researching thou
    Francisco Eguiguren
    @feguiguren
    ok, it works with 'sbt clean' and then 'sbt compile'. If I do 'sbt clean compile' it does not. That is really weird.
    anyway, I don't think that would be a problem as builds in pipelines work with sbt compile.
    Thanks for your help!
    Francisco Eguiguren
    @feguiguren
    I had to add this line to my build.sbt
    Compile / unmanagedSourceDirectories += baseDirectory.value / "target/scala-2.13/classes/models"
    Per-Åke Minborg
    @minborg
    Cool!
    John Bakogiannis
    @jbakoc1

    There is also an additional maven trick to solve the problem as described here: https://speedment.github.io/jpa-streamer/jpa-streamer/1.0.1/quick-start/quick-start.html

    Hi @minborg Is there any tricks for Eclipse IDE? The mvn is not working although Eclipse is recognizing the target as source.

    Per-Åke Minborg
    @minborg
    Here are some tips. I have rarley used Eclips myself so not sure if this is any help: https://stackoverflow.com/questions/1192596/how-do-i-get-eclipse-to-resolve-classes-generated-with-maven-2
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    Hi @minborg when I use jpa-stream select data on DB. It's ok, but when change data on DB, jpastream still get old data. how can I disable cache with jpastream? Thanks
    Per-Åke Minborg
    @minborg
    Hi. Let me check and get back.
    How does your persistence.xml look like?
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    I use spring boot with autoconfigure so I don't have persistance.xml.
    I fixed that issue by way: I create new instance (JPAStreamer jpaStreamer = JPAStreamer.of("sakila")) every I use jpaStreamer. I hope you have better solution
    Thanks so much
    Per-Åke Minborg
    @minborg
    You can @Autowire the jpaStreamer intance
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    I use this demo, I can see it still cannot resolve that issue (change data DB, no restart server and jpastream cannot get new data). Please check that demo, thanks
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    @minborg I have another question regarding about connection jdbc. When I deploy project to production, sometime my app broken with exception message "SQLException: Connection is closed... GenericJDBCException: could not prepare statement...". I try increase pool size with config in application.properties: "spring.datasource.hikari.connectionTimeout=30000; spring.datasource.hikari.maximum-pool-size=60". Have you seen this problem? Thanks so much!!
    Per-Åke Minborg
    @minborg
    @quocnna_twitter No. I have never seen that before. It might be related to hikari? What happens if you use the default connection pool or another connection pool?
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    @minborg I use spring boot, so first I use default connection pool Hikari without any config, everything is ok but after a few hours, the exception show "SocketException: Connection timed out (Read failed)". Then I try config Hakari with params, this issue still cannot resovle. Should I config with what params hikari? Thanks for your reply
    Per-Åke Minborg
    @minborg
    I suspect the problem is related to the connection pool and the JPA provider.
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    Do I need jpastream.close() when I finish my query? If I close it, I cannot use jpastream later because it closed. If I don't close, I think it can many connection after a few hours (cause above issue). Please give me ask another question, can I off banner (JPAStream) when I start up spring boot? Thank you
    Per-Åke Minborg
    @minborg
    The Streams you are using for querying are closed autmatically so you should not need to close the streams. JPAstreamer should not hold any connections between streams so you do not have to close it either.
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    I can see AutoClosingStream.java in autoclose-standard-1.0.2.jar, but it still warning "Connection leak detection". You can try add spring.datasource.hikari.leakDetectionThreshold in application.properties on your project https://github.com/speedment/jpa-streamer-demo/tree/master/spring, you'll see "Apparent connection leak detected". Thanks
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    @minborg if I want manual to close connection, how can I do it? Thanks
    Per-Åke Minborg
    @minborg
    Connections are purely handled by the JPA layer and not JPAstreamer.
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    In my test project, I try implement the both JPARepository and JPAStreamer, everything is ok on local. But when I deploy on production. After a few hours, query by JPARepository still ok, but query by JPAStreamer show exception connection closed. I cannot understand why this is happening. Thanks
    Per-Åke Minborg
    @minborg
    ok. Understood. When you run on local, do you run for a long time?
    Raúl Pampliega Mayoral
    @RaulPampliegaMayoral
    Does anyone know how to make a query like that: select a.id from table a where a.field1 in (select a.field2 from table a where a.field3 = some_condition)?
    Per-Åke Minborg
    @minborg

    Well, you can split that up in two querries

    A) Set<X> set = stream().filter(a$.field3.equal(some_condition)).collect(toSet());
    B) Stream<X> stream().filter(a$.in(set))...

    Nguyen Ngoc Anh Quoc
    @quocnna_twitter

    ok. Understood. When you run on local, do you run for a long time?

    I just run on local by intelij IDE with 5 hours, and it working smooth. I use jpastream with spring boot and postgres, hiraki.

    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    When I don't use jpastream, "Connection leak" will not occurs. when I use jpastream, "Connection leak" occurs. So I think jpastream make connection leak and connection closed. Can you please check connection leak when use jpastream? Thanks
    Raúl Pampliega Mayoral
    @RaulPampliegaMayoral
    @minborg Thanks, I will try it!
    Per-Åke Minborg
    @minborg
    @quocnna_twitter Ok. We will take a look at that.
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    @minborg I solved the issue by manual open and close jpastream every query. Connection leak don't happening and everything on server is good working . But I hope you update version for fix this issue (connection leak). Thanks for your reply
    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    how can I hide banner jpatream in cosolog, when I new and close jpastream every query, it show banner again, it so much, so I want to hiding it. Thanks
    Per-Åke Minborg
    @minborg

    @quocnna_twitter Currently, the banner is shown upon every build of JPAStreamer. I have added an issue that would allow this to be configurable:

    speedment/jpa-streamer#149

    Thank you for the improvement suggestion.

    I have also added this regarding a potential connection leak: speedment/jpa-streamer#147
    Thank you for discovering this issue too!
    Francisco Eguiguren
    @feguiguren
    @quocnna_twitter I'm facing the same issue, connection closed after the service runs for a couple of hours and no data comes into the db.
    wondering if I can catch the exception, close the stream and let it retry.
    I'm using the jpastream as an Akka stream source.

    I solved the issue by manual open and close jpastream every query

    did you 'stream.close()' after each query?

    Nguyen Ngoc Anh Quoc
    @quocnna_twitter
    yes, i use jpastream.close() after each query. I am waiting new version of JPAStream for fix that issue