Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8300273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:30:23+00:00 2026-06-08T16:30:23+00:00

I have a table definition class Transaction( val … ) extends KeyedEntity[Long] { val

  • 0

I have a table definition

class Transaction(
  val ...
) extends KeyedEntity[Long] {
  val id:Long = 0
}

val transaction = table[Transaction]("transactions")

on(transaction) {t =>
    declare(
        t.id is unique
        ... (other fields)
    )
}

The database table was not generated by Squeryl (I created it manually), but the “ID” column is set to PrimaryKey and AutoIncrement.

Now I’m inserting a row in this table:

val row = new Transaction(...)
val rowResult = transaction.insert(row)
println("Id1="+row.id+"; Id2="+rowResult.id)

The row is correctly inserted into the database and there an ID is assigned (!=0).
But the application prints “ID1=0; ID2=0” on the command line.

Why? And how do I get the assigned ID?

edit:
I did also try the table definition this way

class Transaction(
    val id: Long,
    ...
) extends KeyedEntity[Long]

Didn’t make any differences.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:30:25+00:00Added an answer on June 8, 2026 at 4:30 pm

    When I remove the declaration

    t.id is unique
    

    it works. So the problem is solved.

    Is this a bug in squeryl?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with the following declarative definition: class Type(Base): __tablename__ = 'Type'
In the database, I have a definition table that is read from the application
I have a table with expand/collapse javascript acting on the class value assigned to
@Entity @Table(name = parent) public final class Parent extends Base { @OneToOne(cascade = CascadeType.PERSIST,
I have dbml with single table users i want add partial class for User
I have the following object: namespace LearnLINQ1 { [Table(Name=testMe)] public class SubmitTest { [Column(Name=FirstName)]
I have a simple class mapped to a table. Nothing fancy, but I have
I have two tables one being the parent of the other. The child table
I have table with around 70 000 rows. There is 6000 rows that i
I have table in which I am inserting rows for employee but next time

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.