Code Monkey home page Code Monkey logo

scala's People

Contributors

agustafson avatar benjamin3878 avatar dependabot[bot] avatar emacarron avatar eyalfa avatar harawata avatar hazendaz avatar kazuki43zoo avatar mnesarco avatar renovate[bot] avatar simonetripodi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala's Issues

Documentation links broken

The links to both core and sample documentation are broken (404) at http://mybatis.github.io/scala/ . There are many google-able links that lead there (including at the main mybatis site) - you have to really work to find a link to the docs at
http://mybatis.github.io/scala/mybatis-scala-core_2.10/index.html
http://mybatis.github.io/scala/mybatis-scala-samples_2.10/index.html
which I'm guessing are current.

Also, all the links on http://mybatis.github.io/scala/mybatis-scala-samples_2.10/index.html are broken.

jdk 11 compliancy - see travis failure

Need to ensure we can build for jdk 11 as with all other mybatis projects. This one is still not yet compliant and likely due to scala itself at the revision used. Review the results on travis ci as to failure condition.

Dynamic SQL: choose/when/otherwise only valid in a single line

When including a conditional expression to create dynamic SQL using "choose" and enclosed "when" and "otherwise" tags, a Scala MatchError is thrown if there is any whitespace between the tags.
E.g. this works ok:

<choose><when test="sometest">xx</when><otherwise>yy</otherwise></choose>

but this doesn't and throws a MatchError in line 74 of DynamicSQLBuilder.scala:

<choose>
   <when test="sometest">xx</when>
   <otherwise>yy</otherwise>
</choose>

One-to-Many Joins with Immutable Case Classes

I have been wrestling with the most basic join possible--between Person and Address--for hours today, and I would simply like to know if this is possible with immutable case classes. Or do I have to make my fields mutable as in the sample? I would rather I just ask before I go through the extensive effort to make them mutable only to find my code ripped off from the samples still doesn't work.

Thanks.

DefaultObjectFactory.cache is not threadsafe

It looks like the cache in DefaultObjectFactory isn't thread safe. If you have a Configuration that is shared across threads (which I think is legal?), getConstructor can be called concurrently. That might get touched enough that it's not worth making that a SynchronizedMap and maybe should just jump straight to a ConcurrentHashMap. Interestingly the Java implementation of DefaultObjectFactory doesn't cache at all. Is that just a Scala tax?

1:M Insert Failing

I currently have a Person to Address mapping in a 1:M relationship. When I insert a Person bean that has a populated mutable.Seq[Address] in it, I find no exceptions, but the Person instance is inserted while the Address instances are not. I have this in my Person ResultMapping:

collection[Address](
      property = "addresses", //as the bean has person.addresses
      resultMap = Address.addressResultMap,
      column = "p_id",
      notNullColumn = "p_id"
    )

The result is the same whether those last two values are there or not--or one at a time.

Is there something I need to add to Address to tell MyBatis (Scala) where Person's foreign key in Address is? Or what else should I look at to insert the children in this 1:M relationship?

Thanks.

Nested result map for list of strings is super-counter-intuitive and does not allow for case classes

In my project I usually define case classes for mapping, like this:

case class SomeEntity(key: String, values: Seq[String]) {
   def this() = this(null, Seq.empty)
}

Today I tried to do the following thing:

  val select = new SelectListBy[Int, SomeEntity] {
    resultMap = new ResultMap[SomeEntity] {
      result(column = "key", property = "key")
      collection[String](property = "values", resultMap = new ResultMap[String] {
      })
    }

    def xsql = <xsql>SELECT key, some_column_name FROM ... WHERE xyz={"id"?} 
  </xsql>
  }

And now:

  • In order for it to work, I have to define nested result map (as above) without any configuration. It magically maps some_column_name to list of strings. I spent quite a long time to figure it out.
  • I cannot use case class, even though I can use it for any other situation. I have to do:
class SomeEntity {
   var key: String = _
   var values: Seq[String] = _
}

Expected results:

  • Nested list of Strings does not need to define config-lessResultMap in order to work
  • Consistent support for case classes with no-arg constructors

can i use config without xml?

in java version i do like this

DataSource dataSource = BlogDataSourceFactory.getBlogDataSource();
TransactionFactory transactionFactory =
  new JdbcTransactionFactory();
Environment environment =
  new Environment("development", transactionFactory, dataSource);
Configuration configuration = new Configuration(environment);
configuration.addMapper(BlogMapper.class);
SqlSessionFactory sqlSessionFactory =
  new SqlSessionFactoryBuilder().build(configuration);

Improper handling of Tuple2 types

org.apache.ibatis.reflection.Reflector always returns null for _1 and _2 properites of Tuple2 type. The code below always puts null in _1 and _2 placeholders:

  val insert = new Insert[Tuple2[Int, Int]] {
    def xsql = <xsql>INSERT INTO some_table(col1, col2) VALUES ({ "_1"? } ,{ "_2"? }) </xsql>
  }

Interrestingly, it works for Tuple3 :) Tested against mybatis scala 1.0.1

Methods should not be properties

In Scala, the use of 'properties' (e.g. methods without parens) should be reserved to things that are property-like.

So, for instance, if you have a class Person, it's perfectly reasonable to have a method declared:
def name

But as far as I know it's not considered idiomatic to have a method such as:
def saveToDatabase

But rather you'd define it:
def saveToDatabase()

I noticed that in the session class you have a lot of paren-less methods that seem to be, well, methods, and I think violate the above rule.

Fortunately, you can fix this if you choose (by adding empty parens to all relevant methods) without breaking backward compatibility.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • actions/setup-java v4
.github/workflows/codeql.yml
  • actions/checkout v4
  • actions/setup-java v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/coveralls.yaml
  • actions/checkout v4
  • actions/setup-java v4
.github/workflows/site.yaml
  • actions/checkout v4
  • actions/setup-java v4
  • JamesIves/github-pages-deploy-action v4
.github/workflows/sonar.yaml
  • actions/checkout v4
  • actions/setup-java v4
.github/workflows/sonatype.yaml
  • actions/checkout v4
  • actions/setup-java v4
maven
mybatis-scala-core/pom.xml
  • org.mybatis.scala:mybatis-scala-parent_2.13 1.3.2-SNAPSHOT
  • org.mybatis:mybatis 3.5.16
  • org.scalatest:scalatest_2.13 3.2.19
  • org.hsqldb:hsqldb 2.7.3
  • org.scalatest:scalatest-maven-plugin 2.2.0
  • net.alchim31.maven:scala-maven-plugin 4.9.2
mybatis-scala-samples/pom.xml
  • org.mybatis.scala:mybatis-scala-parent_2.13 1.3.2-SNAPSHOT
  • org.hsqldb:hsqldb 2.7.3
pom.xml
  • org.mybatis:mybatis-parent 45
  • org.scala-lang:scala-library 2.13.14
  • org.scala-lang.modules:scala-xml_2.13 2.3.0
  • net.alchim31.maven:scala-maven-plugin 4.9.2
maven-wrapper
.mvn/wrapper/maven-wrapper.properties
  • maven 3.9.9
  • maven-wrapper 3.3.2

  • Check this box to trigger a request for Renovate to run again on this repository

Invalid reporting plugin definition on maven-site-plugin

Since maven-site-plugin 3.3 has not been supported the <reportPlugins> element on <configuration>.

Invalid configuration:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-site-plugin</artifactId>
  <configuration>
    <reportPlugins>  <!-- ### Invalid definition ### -->
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <version>2.15.2</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.12.1</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>changes-report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </reportPlugins>
  </configuration>
</plugin>

For details see https://maven.apache.org/plugins/maven-site-plugin/maven-3.html#Configuration_formats.

mybatis-scala-samples compile error

[info] Compiling 15 Scala sources to /Users/hary/workspace/scala/mybatis-scala-samples/target/scala-2.11/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.11.6. Compiling...
[info] Compilation completed in 7.338 s
[error] /Users/hary/workspace/scala/mybatis-scala-samples/src/main/scala/org/mybatis/scala/samples/performance/ProfileTest.scala:97: method handle: (callback: org.mybatis.scala.session.ResultContext => Unit)(implicit s: org.mybatis.scala.session.Session)Unit does not take type parameters.
[error] select.handle[TestBean] { context =>
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 9 s, completed 2017-6-19 20:33:49

master fails to compile

hi guys,
I'm getting this compilation error on a fresh git clone of master:

D:\dev\mybatis\mybatis-scala\mybatis-scala-core\src\main\scala\org\mybatis\scala\config\ConfigurationSpace.scala
Error:(79, 33) not enough arguments for method useNewCache: (x$1: Class[_ <: org.apache.ibatis.cache.Cache], x$2: Class[_ <: org.apache.ibatis.cache.Cache], x$3: Long, x$4: Integer, x$5: Boolean, x$6: Boolean, x$7: java.util.Properties)org.apache.ibatis.cache.Cache.
Unspecified value parameter x$7
builderAssistant.useNewCache(
^

this seems to be related to a new parameter required by the useNewCache method, 'boolean blocking'.

does anyone know when did this start failing? it seems to be that the mybatis dependency was upgraded to v3.3.0 on July, is it possible that this broke the build?
if so, how comes travis CI didn't catch this?

a more concrete question, how should this be fixed? it's quite easy to add this parameter throughout the call chain, but at the end there's supposed to be a reasonable default to, anyone knows what this default is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.