Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Mark Schrijver
    @ractoc
    I'm just not sure what thebestway would be to link in those other two tables
    I'm currently reusing the service method I already have in place, starting from line 59
    but that means those methods getRegistration and getInvitation get called once per record found
    which might not work so well when the table gets bigger
    Per-Åke Minborg
    @minborg

    Hi Mark. This is the classical N+1 select problem.

    As you point out, the solution does not scale that well. Why not create a join and add in the simple predicates as the table, respectively (e.g. START_DATE_TIME)?

    Mark Schrijver
    @ractoc
    so effectively I would then be creating a select statemet joining three tables, but restricting the actual selected fields to the one table I need....
    and with the distinct keyword, I could then exclude any duplicates?
    hhmm..
    I might need to figure out the actual SQL for that first, before converting it to speedment stream based
    Per-Åke Minborg
    @minborg
    Hi @nist42 . So it worked with the Speedment Application Builder? Not sure I understand the case where it did not work. Could you please elaborate a bit?
    Mark Schrijver
    @ractoc
    finally came around to try and figure out how to join those two tables
    but I'm running into a problem.
    I set it all up with Speedment:
    fleetJoin
    .where(OWNER.equal(charId)
    .or(Fleet.RESTRICTED.equal(false)))
    .leftJoinOn(Invite.FLEET_ID).equal(Fleet.ID)
    .where((Invite.TYPE.equal("character").and(Invite.INVITEE_ID.equal(charId)))
    .or(Invite.TYPE.equal("corporation").and(Invite.INVITEE_ID.equal(corpId)))
    .or(Invite.TYPE.isNull()))
    .build()
    .stream()
    .count()
    this results in a rowcount of 0
    when I run the corresponding query against the same database directly, with the same parameters I get from the speedmet logs, I get 2 resulting rows:
    2021-02-16T22:47:13.556Z DEBUG [http-nio-8282-exec-1] (#STREAM) - SELECT A.id,A.name,A.owner,A.start,A.duration,A.start_date_time,A.type_id,A.restricted,A.description, B.id,B.fleet_id,B.type,B.key,B.invitee_id FROM eve_fleetmanager.fleet AS A LEFT JOIN eve_fleetmanager.invite AS B ON (B.fleet_id = A.id) WHERE ((A.owner = ?) OR (A.restricted = ? COLLATE utf8_bin)) AND (((B.type = ? COLLATE utf8_bin) AND (B.invitee_id = ?)) OR ((B.type = ? COLLATE utf8_bin) AND (B.invitee_id = ?)) OR (B.type IS NULL)) [Integer 2115635889, String false, String character, Integer 2115635889, String corporation, Integer 98628638]
    could a cause of this be that my B result is empty for both rows returned?
    the debgger says I'm getting a Tule20OfNullables out of the build method
    Mark Schrijver
    @ractoc
    missed a bit of the Java code...
    Long rowCount = joinComponent.from(FleetManager.IDENTIFIER)
    .where(OWNER.equal(charId)
    .or(Fleet.RESTRICTED.equal(false)))
    .rightJoinOn(Invite.FLEET_ID).equal(Fleet.ID)
    .where((Invite.TYPE.equal("character").and(Invite.INVITEE_ID.equal(charId)))
    .or(Invite.TYPE.equal("corporation").and(Invite.INVITEE_ID.equal(corpId)))
    .or(Invite.TYPE.isNull()))
    .build()
    .stream()
    .count();
    so the query is good, I tested that in mysql directly
    but the speedment code is giving me 0 rows returned
    Per-Åke Minborg
    @minborg
    The log says “LEFT JOIN” but the last code secion is rightJoinOn()?
    Mark Schrijver
    @ractoc
    Yeha, I cought that as well later on
    chaning that in the code didn't fix it though
    I have since changed my search criteria a bit to work around this problem so I don't need the outer join anymore
    this works well enough for now, and sees to speed up the query as well
    Per-Åke Minborg
    @minborg
    Great @ractoc !
    minhphuc
    @ngminhphuc

    hi, I'm generate code from mysql database to REST but when runing Spring Boot, I got message: Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.

    Thu Feb 25 16:17:09 ICT 2021
    There was an unexpected error (type=Not Found, status=404).
    No message available

    Per-Åke Minborg
    @minborg
    Which URL do you access initially?
    http://ip:port/appname/table (generated Rest Controller)
    Per-Åke Minborg
    @minborg
    Which mappings do you see in the Spring logs when you start you appliation?
    minhphuc
    @ngminhphuc
    2021-02-25 16:16:48.396 INFO 13920 --- [ main]
    com.ngminhphuc.destinymatcher.Main : Starting Main on dev-w19 with PID 13920 (E:\projects\2021\4.destinymatcher\target\classes started by minhphuc in E:\projects\2021\4.destinymatcher)
    2021-02-25 16:16:48.401 INFO 13920 --- [ main] com.ngminhphuc.destinymatcher.Main : No active profile set, falling back to default profiles: default
    2021-02-25 16:16:50.032 INFO 13920 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8000 (http)
    2021-02-25 16:16:50.049 INFO 13920 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
    2021-02-25 16:16:50.049 INFO 13920 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
    2021-02-25 16:16:50.296 INFO 13920 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
    2021-02-25 16:16:50.297 INFO 13920 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1818 ms
    2021-02-25 16:16:50.606 INFO 13920 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
    2021-02-25 16:16:50.919 INFO 13920 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8000 (http) with context path ''
    2021-02-25 16:16:50.927 INFO 13920 --- [ main] com.ngminhphuc.destinymatcher.Main : Started Main in 3.159 seconds (JVM running for 4.483)
    2021-02-25 16:17:08.961 INFO 13920 --- [nio-8000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
    2021-02-25 16:17:08.962 INFO 13920 --- [nio-8000-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
    2021-02-25 16:17:08.973 INFO 13920 --- [nio-8000-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms
    Per-Åke Minborg
    @minborg
    looks like your appname/table end points are not deployed.
    Make sure your main app is in a package that has the controllers etc as a sub-package as the classpath scanner will otherwise not pick them up.
    minhphuc
    @ngminhphuc
    ok, thanks Minborg
    minhphuc
    @ngminhphuc
    hi Minborg, can you give sample of application.properties for connect mysql from another server, I've search some atrribute likes: jdbc.username=xxxx
    jdbc.password=xxxx
    url=jdbc:mysql://ip:port/dbname
    but it return error: Caused by: java.sql.SQLException: Access denied for user ....
    minhphuc
    @ngminhphuc
    how to get swagger documentation from generated REST code, maybe this feature is removed
    Per-Åke Minborg
    @minborg
    This is described in the manual
    654968949
    @654968949
    Hello, I don't want to generate the entire database, I want to use "Speedment" to generate a separate table, what do I do?
    Is anybody there?
    654968949
    @654968949
    hello!
    Per-Åke Minborg
    @minborg
    Hi there. You can just disable all other tables in the GUI or you could edit the JSON file and remove the unwanted tables.
    654968949
    @654968949
    Thanks. In fact, what I want to ask is, during the development process, I only changed one field of a table in the database, do I also need to use The GUI generate all the table data of the whole database?