Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Flavio W. Brasil
    @fwbrasil
    the entities are loaded lazily by default
    could you explain further the use-case?
    Ryan Proud
    @spry-rproud
    Just trying to reduce the calls to the database. Don't want to have to do a select and insert for every new Foo.
    So if I could create a dummy Bar entity which just references the id it would be ideal.
    Flavio W. Brasil
    @fwbrasil
    byId[Bar](barId) is already lazy
    sorry, i’m wrong
    Ryan Proud
    @spry-rproud
    Lazy was bad wording by me.
    Flavio W. Brasil
    @fwbrasil
    if you use byId[Bar](barId, initialized = false) activate doesn’t touch the database
    Ryan Proud
    @spry-rproud
    Ok, thanks. That sounds like what I'm looking for.
    Flavio W. Brasil
    @fwbrasil
    cool :)
    Ryan Proud
    @spry-rproud
    Is it possible to enable statement logging?
    Nevermind, found the open issue.
    Ryan Proud
    @spry-rproud
    Are there any known issues with reinitializeContext? Or anything else required to clean the live cache? When calling it I'm still getting old data from queries also in the logs I'm not seeing anything about the context being reloaded, just HikariPool cleanup, which is likely just coincidental. I'm using 1.7.
    Flavio W. Brasil
    @fwbrasil
    it is an unknown issue
    could you open an issue and describe your use-case?
    Ryan Proud
    @spry-rproud
    def reinitializeContext =
            logInfo("reinitializing context " + contextName) {
                clearCachedQueries
                liveCache.reinitialize
                storages.foreach(_.reinitialize)
                reinitializeIdGenerators
                unloadIndexes
            }
    I'm not sure how Grizzled logger works, but is the function block dependant on the log level?
    Flavio W. Brasil
    @fwbrasil
    yep, it is info
    Ryan Proud
    @spry-rproud
    Does the STM allow for transactional blocks to execute concurrently?
    Flavio W. Brasil
    @fwbrasil
    @spry-rproud yep
    Ryan Proud
    @spry-rproud
    Are there any examples available to demonstrate this. I'm having issues where all my transactions are blocking until the previous one completes.
    Flavio W. Brasil
    @fwbrasil
    @spry-rproud http://databen.ch/
    Ryan Proud
    @spry-rproud
    Is there a way to mark an entity as "dirty" without modifying, so we can block on reads?
    Ryan Proud
    @spry-rproud
    Is there any support for postgresql array or json types?
    Ryan Proud
    @spry-rproud
    @fwbrasil Hey do you have some time to answer a few questions?
    Flavio W. Brasil
    @fwbrasil
    @spry-rproud hey
    yeah, sorry I forgot to answer the previous ones
    go for it
    Ryan Proud
    @spry-rproud
    No worries, we wondering if it's possible to override the Postgres driver used by the context.
    Flavio W. Brasil
    @fwbrasil
    use another postgres jdbc driver?
    Ryan Proud
    @spry-rproud
    Yes, we're trying to use slick-pg to do some queries on json columns and it appears to override the slick PostgresDriver.
    object MyPostgresDriver extends PostgresDriver
                                with PgJson4sSupport
                                with array.PgArrayJdbcTypes {
        /// for json support
        override val pgjson = "jsonb"
        type DOCType = text.Document
        override val jsonMethods = org.json4s.native.JsonMethods
    
        override lazy val Implicit = new Implicits with JsonImplicits
        override val simple = new Implicits with SimpleQL with JsonImplicits {
          implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
        }
    
        val plainImplicits = new Implicits with Json4sJsonPlainImplicits
      }
    Flavio W. Brasil
    @fwbrasil
    I see
    let me check
    how do you create your persistence context?
    I think you can override lazy val driver = MyPostgresDriver
    Ryan Proud
    @spry-rproud
    object myContext extends ActivateContext with SlickQueryContext {
        val storage = new PooledJdbcRelationalStorage {
                val jdbcDriver = "org.postgresql.Driver"
                val user = Some("postgres")
                val password = None
                val url = "jdbc:postgresql://127.0.0.1/json-test"
                val dialect = postgresqlDialect
            }
    }
    Flavio W. Brasil
    @fwbrasil
    object myContext extends ActivateContext with SlickQueryContext {
        override lazy val driver = MyPostgresDriver
        val storage = new PooledJdbcRelationalStorage {
                val jdbcDriver = "org.postgresql.Driver"
                val user = Some("postgres")
                val password = None
                val url = "jdbc:postgresql://127.0.0.1/json-test"
                val dialect = postgresqlDialect
            }
    }
    Ryan Proud
    @spry-rproud
    Ok, that may work. I'll keep looking into it. Thanks.
    Flavio W. Brasil
    @fwbrasil
    np :)
    Ryan Proud
    @spry-rproud
    Is it possible to override the default DateStorageValue for postgresql? (ie. "timestamptz")
    Flavio W. Brasil
    @fwbrasil
    you can override the toSqlDdl method
    new postgresqlDialect(string => "\"" + string + "\””, string => string) {
       override def toSqlDdl(storageValue: StorageValue): String =
            storageValue match {
                case value: DateStorageValue =>
                      “timestamptz”
                case other => super.toSqlDdl(other)
           }
    }
    @spry-rproud ^
    Ryan Proud
    @spry-rproud
    Thanks. That seems to work great.
    Flavio W. Brasil
    @fwbrasil
    :clap:
    Ryan Proud
    @spry-rproud
    Is it possible to have a context ignore certain migrations? I'm having some issues where H2 is having issues with a customScript migration which isn't entirely necessary for tests.
    Flavio W. Brasil
    @fwbrasil
    maybe check the context storage type in the custom script?
    if(context.storage.dialect != h2)
    Ryan Proud
    @spry-rproud
    Does TransientMemoryStorage not maintain StorageVersion?
    Flavio W. Brasil
    @fwbrasil
    it should maintain, I think