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 6776107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:59:16+00:00 2026-05-26T15:59:16+00:00

Update : I’ve accepted an answer but I’m still very curious why what I

  • 0

Update: I’ve accepted an answer but I’m still very curious why what I tried doesn’t work (to understand Scala implicit behaviors). Any other answers would be greatly appreciated.

(Hopefully this question is answerable without much knowledge of Circumflex, but just in case, here’s the documented source code reference.)

I’m trying to add some convenience functions over the Circumflex ORM library, but I’m running into some barriers trying to use Scala implicit conversions. Below, why doesn’t the implicit conversion trigger? I suspect there’s some complex interaction with the subclassing and/or the recursive type parameters.

import ru.circumflex.orm._

// I subclass Record and Table to add my own convenience methods etc. (not pasted, irrelevant)
abstract class XRecord[PK, R <: XRecord[PK, R]] extends Record[PK, R] { this: R => }
trait XTable[PK, R <: XRecord[PK, R]] extends Table[PK, R] { this: R => }

// Example entity.
class Org extends XRecord[Long,Org] {
  val id = "id".BIGINT.NOT_NULL.AUTO_INCREMENT
  def PRIMARY_KEY = id
  def relation = Org
}
object Org extends Org with XTable[Long,Org]

object Test extends App {
  // I want this conversion to work for all Records, not just XRecords.
  // Need implicit f to be able to accept XRecord, a subclass of Record.
  implicit def toRichRelationNode[PK, R <: Record[PK,R], RR](xs: RR)(implicit f: RR => RelationNode[PK,R]) =
    new { def GET(f: RelationNode[PK,R] => Predicate) = 0 }

  // This works.
  toRichRelationNode(Org) GET (_.id EQ 1)

  // This doesn't:
  // "No implicit view available from Org.type => ru.circumflex.orm.RelationNode[PK,R]."
  Org GET (_.id EQ 1)
}
  • 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-05-26T15:59:17+00:00Added an answer on May 26, 2026 at 3:59 pm

    Frankly, I’ve never used implicit parameters and I’ve never met a condition which forced me to use them (Circumflex itself is written without implicit parameters and goes pretty well as far as I am concerned).

    Anyhow, I’ve been able to reproduce your scenario and make it work. It took 2 implicits, however, to make everything go fine. Here’s the code:

    // The helper which holds custom methods, it will accept any subclass of R
    class NodeHelper[PK, R <: Record[PK, R]](val node: RelationNode[PK, R]) {
      def GET(f: R => Predicate): Option[R] = node.criteria.add(f(node)).unique()
    } 
    
    // Now the implicits and usage scenario
    
    object Tester {
    
      implicit def nodeToHelper[PK, R <: Record[PK, R]](node: RelationNode[PK, R]): NodeHelper[PK, R] = new NodeHelper(node)
    
      implicit def tableToHelper[PK, R <: Record[PK, R]](table: Table[PK, R]): NodeHelper[PK, R] = new NodeHelper(table.AS("this"))
    
      // Testing with table
      println(User GET (_.cn EQ "patrick"))
      // Testing with node
      println(User.AS("u") GET (_.cn EQ "patrick"))
    }
    
    // And finally, the test model we've mentioned above
    
    class User extends Record[Long, User] {
      def PRIMARY_KEY = id
      val id = "id".BIGINT.NOT_NULL.AUTO_INCREMENT
      val cn = "cn".TEXT.NOT_NULL
      def relation = User
    }
    
    object User extends User with Table[Long, User]
    

    Hope it helps.

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

Sidebar

Related Questions

* UPDATE: *I've already answered my question. But you can still give me advise
Update Mr Wizard's answer gives pixel-perfect results, but it is Windows-only and destroys the
UPDATE 11/18/2011 Check the accepted answer. It works and its a life saver! Hey
*Update: This now doesn't work on either the iPhone or the Simulator. After I
Update: Solved, with code I got it working, see my answer below for the
Update: Thanks for everyone who helped out - the answer to this one lay
UPDATE : Answer at the bottom. Hi Guys, How to initialize an 'array of
UPDATE: Skip to the answer if you want to save yourself the lengthy preamble.
Update: NSURLConnection now seems to properly support 100-Continue. In any case, this answer contains
Update: question now contains the final edited answer! I now use the following (final

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.