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
    using enum.withName
    Ryan Proud
    @spry-rproud
    Sorry that's how they serialize a typical Enumeration, the problem is the value isn't an Enumeration it's a case class.
    I'm just saying it would be safer if Activate allowed Enumerations defined as follows. This would prevent these types of issues.
    object Status extends Enumeration {
        val ACTIVE = Value("active")
        val INACTIVE = Value("inactive")
    }
    Flavio W. Brasil
    @fwbrasil
    it would be better, but it isn’t possible
    Ryan Proud
    @spry-rproud
    Why?
    Flavio W. Brasil
    @fwbrasil
    there isn’t a way to deserialize the enum without the user specifying the enum object
    json4s requires an implicit formatter for the enum, right?
    Ryan Proud
    @spry-rproud
    Yes
    Flavio W. Brasil
    @fwbrasil
    it isn’t possible to use the same approach for activate
    because there isn’t a way to fail at compilation time
    it would be possible to fail at runtime if the enum serializer is not provided, but i’m not sure it is a good approach
    Flavio W. Brasil
    @fwbrasil
    i was thinking, does it work if you change the enum to be:
    object Status extends Enumeration {
      case class Status(name: String) extends Val(name)
      val ACTIVE: Value = Status("active")
      val INACTIVE: Value = Status("inactive")
    }
    try Value or Val
    Ryan Proud
    @spry-rproud
    No, that just makes name protected
    Flavio W. Brasil
    @fwbrasil
    k
    Ryan Proud
    @spry-rproud
    Do you know offhand what tests will test Enum serialization in activate?
    Flavio W. Brasil
    @fwbrasil
    many tests use this check
    but do you think that there is an issue using enums with activate (without json4s)?
    Ryan Proud
    @spry-rproud
    Yes, because it gives the possibility that someone could create an instance of the enum outside of the object.
    Status.Status("active") does not necessarily equal Status.withName("active")
    Flavio W. Brasil
    @fwbrasil
    makes sense, that could be a problem
    Ryan Proud
    @spry-rproud
    Is it possible to create a new Entity with a reference without retrieving the referenced entity?
    class Bar(var name: String) extends EntityWithGeneratedID[Long]
    class Foo(var a: String, var b: Bar) extends EntityWithGeneratedID[Long]
    
    val barId = 2l
    
    transactional {
        new Foo("something", lazyById[Bar](barId))
    }
    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