Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select in scala causes runtime error #204

Closed
khoran opened this issue Jul 29, 2012 · 5 comments
Closed

select in scala causes runtime error #204

khoran opened this issue Jul 29, 2012 · 5 comments

Comments

@khoran
Copy link

@khoran khoran commented Jul 29, 2012

The following query compiles, but results in a runtime error:

val allPrograms = querySingle(QFeedPrograms)((q,t)=> q from t select(t.langno,t.progno,t.title,t.programTypeKey,t.isoMacrolanguageCode, t.isoMacrolanguageName, t.isoLanguageCode,t.isoLanguageName,t.youtubeUrl,t.sample))
>Exception occured while processing /language/all<pre>Message: java.lang.NullPointerException
        com.mysema.query.sql.JavaTypeMapping.findType(JavaTypeMapping.java:137)
        com.mysema.query.sql.JavaTypeMapping.getType(JavaTypeMapping.java:114)
        com.mysema.query.sql.Configuration.getType(Configuration.java:123)
        com.mysema.query.sql.Configuration.get(Configuration.java:93)
        com.mysema.query.sql.AbstractSQLQuery.get(AbstractSQLQuery.java:287)
        com.mysema.query.sql.AbstractSQLQuery.newInstance(AbstractSQLQuery.java:494)
        com.mysema.query.sql.AbstractSQLQuery.access$000(AbstractSQLQuery.java:62)
        com.mysema.query.sql.AbstractSQLQuery$3.produceNext(AbstractSQLQuery.java:427)
        com.mysema.query.sql.SQLResultIterator.next(SQLResultIterator.java:81)
        com.mysema.commons.lang.IteratorAdapter.asList(IteratorAdapter.java:40)
        com.mysema.query.sql.AbstractSQLQuery.list(AbstractSQLQuery.java:469)
        com.mysema.query.scala.RichProjectable.select(Helpers.scala:99)
        net.globalrecordings.LanguageFactory$$anonfun$21.apply(DataObjects.scala:373)
        net.globalrecordings.LanguageFactory$$anonfun$21.apply(DataObjects.scala:373)
        net.globalrecordings.GrDatabaseUtils$$anonfun$querySingle$1.apply(GrDatabaseUtils.scala:18)
        net.globalrecordings.GrDatabaseUtils$$anonfun$querySingle$1.apply(GrDatabaseUtils.scala:18)
        net.globalrecordings.LiftUtils$$anonfun$useConnection$1.apply(LiftUtils.scala:8)
        net.globalrecordings.LiftUtils$$anonfun$useConnection$1.apply(LiftUtils.scala:8)
        net.liftweb.db.DB$$anonfun$use$1.apply(DB.scala:639)
        net.liftweb.util.DynoVar$class.run(ThreadGlobal.scala:95)
        net.liftweb.db.DB$class.use(DB.scala:636)
        net.liftweb.db.DB$$anon$1.use(DB.scala:38)
        <truncated>

I regenerated the scala code for the table with the lasted version of querydsl, but that did not help. This was using version 2.7.1-BUILD-SNAPSHOT.

@timowest
Copy link
Member

@timowest timowest commented Jul 30, 2012

How does the class of t look like? I am especially interested in the path declarations : t.langno,t.progno,t.title,t.programTypeKey,t.isoMacrolanguageCode, t.isoMacrolanguageName, t.isoLanguageCode,t.isoLanguageName,t.youtubeUrl,t.sample

@khoran
Copy link
Author

@khoran khoran commented Jul 30, 2012

package net.globalrecordings.gr_database.websites

import com.mysema.query.types._
import com.mysema.query.scala._

import com.mysema.query.types.PathMetadataFactory._;

import com.mysema.query.scala.sql.RelationalPathImpl

import com.mysema.query.sql._

object QFeedPrograms extends QFeedPrograms("feedPrograms") {
  override def as(variable: String) = new QFeedPrograms(variable)

}

class QFeedPrograms(md: PathMetadata[_]) extends RelationalPathImpl[FeedPrograms](md, "websites", "feed_programs") {
  def this(variable: String) = this(forVariable(variable))

  def this(parent: Path[_], property: String) = this(forProperty(parent, property))

  val isoLanguageCode = createString("iso_language_code")

  val isoLanguageName = createString("iso_language_name")

  val isoMacrolanguageCode = createString("iso_macrolanguage_code")

  val isoMacrolanguageName = createString("iso_macrolanguage_name")

  val langno = createNumber[Int]("langno")

  val progno = createString("progno")

  val programTypeKey = createNumber[Int]("program_type_key")

  val sample = createString("sample")

  val title = createString("title")

  val youtubeUrl = createString("youtube_url")

}

@timowest
Copy link
Member

@timowest timowest commented Jul 30, 2012

I just deployed a new version of the SNAPSHOT, could you try again?

@khoran
Copy link
Author

@khoran khoran commented Jul 30, 2012

Works great, thanks!

@timowest
Copy link
Member

@timowest timowest commented Aug 4, 2012

Released in 2.7.2

@timowest timowest closed this Aug 4, 2012
timowest added a commit that referenced this issue Nov 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants