Giter Site home page Giter Site logo

Comments (5)

tjweir avatar tjweir commented on July 22, 2024

I posted this to the mailing list back in december. Posting again so it's preserved :)

I tested this with Scala 2.7.3 and the Lift 1.0 release.
Recently I wanted to have a Mapper with a String uuid as primary key. I found out that MappedStringIndex does that. It didn't work though.

Using it with with a derby driver threw this exception:

Caused by: java.sql.SQLException: 'ID' cannot be a column of a

primary key or unique key because it can contain null values.

The create table looked here like it generated the id itself, so the lift generated id isn't saved in the db.

Using the H2 driver:
CREATE TABLE myuuidmapper (id VARCHAR(64)) INSERT INTO myuuidmapper () VALUES ()

This means the table has been created but the lift-generated id was not saved in the database.

I attached an example project. Boot.scala is configured to use the Derby driver. If requested I can provide an example for H2.

from framework.

dchenbecker avatar dchenbecker commented on July 22, 2024

This is in progress, and dependent on issue #231 making it into trunk. We'll have to discuss whether we want to back-port some of the related code into the 1.0 line.

from framework.

dchenbecker avatar dchenbecker commented on July 22, 2024

This works now in 1.1-SNAPSHOT by modifying the MyUuidMapper class to change:

object id extends MappedStringIndex(this, 64)

to

object id extends MappedStringIndex(this, 64) {
  override def dbNotNull_? = true
  override def dbAutogenerated_? = false
}

from framework.

github-importer avatar github-importer commented on July 22, 2024

Imported from GitHub: http://github.com/dpp/liftweb/issues/13/find

from framework.

github-importer avatar github-importer commented on July 22, 2024

Imported from Assembla: http://www.assembla.com/spaces/liftweb/tickets/13

from framework.

Related Issues (20)

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.