Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Per-Åke Minborg
    @minborg
    Welcome to the JPAstreamer gitter channel!
    Per-Åke Minborg
    @minborg
    I got a question about Spring and JPAstreamer. The easiest way to use Spring and Streamer is to use the Stream integration as described here: https://speedment.github.io/jpa-streamer/jpa-streamer/0.1.7/get-jpa-streamer/spring_integration.html
    nyencharla
    @nyencharla
    hi
    I am a little surprised that the queries generated by JPA streamer is not parameterized for most of attributes
    nyencharla
    @nyencharla
    is there a way we can force parametrized ?
    Per-Åke Minborg
    @minborg
    JPAstreamer is using standard JPA CriteriaBuilders, TypedQuery etc. Can you elaborate what you mean?
    Per-Åke Minborg
    @minborg
    ok. I see the details from another channel. Let me check.
    Per-Åke Minborg
    @minborg
    Thanks for you message and also for raising an issue. We will try to fix the issue as soon as possible.
    Francisco Eguiguren
    @feguiguren
    Hi Folks, quick question:
    • When I stream a result set, does it stream it from the DB or reads the whole result set into memory?
    Per-Åke Minborg
    @minborg
    It streams from the database directly. So if you, for example, filter the stream using some predicate, only the rows satisfying that predicate are ever pulled in from the database into the JVM.
    Francisco Eguiguren
    @feguiguren
    are all rows that satisfy the predicate stored in memory?
    or are they retrieved as consumption happens?
    (similarly to what Slick does for Scala http://scala-slick.org/)
    Per-Åke Minborg
    @minborg
    The are lazily pulled in as they are consumed.
    Francisco Eguiguren
    @feguiguren
    that is awesome!
    thanks!
    Per-Åke Minborg
    @minborg
    Thanks. I hope you like it!
    Francisco Eguiguren
    @feguiguren
    Hi again folks, I'm seeing this error and having trouble trying to figure out how to solve it.
    It seems to me that the Akks stream is trying to do something, which calls for the iterator() method in the collection, which is not supported.
    [error] - application-akka.actor.default-dispatcher-5 - a.a.RepointableActorRef - Error during preStart in [akka.stream.impl.JavaStreamSource@66839a90]: The iterator() method is unsupported because otherwise the AutoClose property cannot be guaranteed
    java.lang.UnsupportedOperationException: The iterator() method is unsupported because otherwise the AutoClose property cannot be guaranteed
        at com.speedment.jpastreamer.autoclose.standard.internal.AbstractAutoClosingBaseStream.newUnsupportedException(AbstractAutoClosingBaseStream.java:125)
        at com.speedment.jpastreamer.autoclose.standard.internal.AutoClosingStream.iterator(AutoClosingStream.java:227)
        at akka.stream.impl.JavaStreamSource$$anon$1.preStart(JavaStreamSource.scala:28)
        at akka.stream.impl.fusing.GraphInterpreter.init(GraphInterpreter.scala:306)
        at akka.stream.impl.fusing.GraphInterpreterShell.init(ActorGraphInterpreter.scala:594)
        at akka.stream.impl.fusing.ActorGraphInterpreter.tryInit(ActorGraphInterpreter.scala:702)
        at akka.stream.impl.fusing.ActorGraphInterpreter.preStart(ActorGraphInterpreter.scala:751)
        at akka.actor.Actor.aroundPreStart(Actor.scala:548)
        at akka.actor.Actor.aroundPreStart$(Actor.scala:548)
    Francisco Eguiguren
    @feguiguren
    ok, the problem seems to be that the Akka Stream Source uses iterator for it's operations.
    override def preStart(): Unit = {
            stream = open()
            iter = stream.iterator()
          }
    
          override def postStop(): Unit = {
            if (stream ne null)
              stream.close()
          }
    
          override def onPull(): Unit = {
            if (iter.hasNext) {
              push(out, iter.next())
            } else {
              complete(out)
            }
          }
    Francisco Eguiguren
    @feguiguren

    mmm seems that the

    https://github.com/speedment/jpa-streamer/blob/99d63183b66414d0d653d26138de51570b4e086a/provider/autoclose-standard/src/main/java/com/speedment/jpastreamer/autoclose/standard/internal/AbstractAutoClosingBaseStream.java#L49

    is set to false. Wonder if there is a way to set it to true, I see that the code handles the true value, so wondering why is set to false by default.

    Francisco Eguiguren
    @feguiguren

    ah! this solved my problem:

    System.setProperty("jpastreamer.allowiteratorandspliterator", "true");

    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