Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PersistenceException when using Ebean not()
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave Womer  
View profile  
 More options Nov 15 2012, 2:10 pm
From: Dave Womer <dave.wo...@gmail.com>
Date: Thu, 15 Nov 2012 11:10:16 -0800 (PST)
Local: Thurs, Nov 15 2012 2:10 pm
Subject: [2.04 Java] PersistenceException when using Ebean not()

Hello everyone.  I'm trying to compare to sets of data from the same table
using the following query:

find.where().eq("job_id", firstJobId).where().not(Expr.in("ap_mac",find
.where().eq("job_id", secondJobId).findList())).findList();

It works fine if the data from firstJobId has records not in the
secondJobId, but when I reverse it I get the exception below.  Anyone seen
this before? Or is there a better way to handle this query?

javax.persistence.PersistenceException: No ScalarType registered for class
models.AP_Uptime

at com.avaje.ebeaninternal.server.persist.Binder.bindObject(Binder.java:183)

at
com.avaje.ebeaninternal.server.query.CQueryPredicates.bind(CQueryPredicates .java:162)

at
com.avaje.ebeaninternal.server.query.CQuery.prepareBindExecuteQuery(CQuery. java:413)

at
com.avaje.ebeaninternal.server.query.CQueryEngine.findMany(CQueryEngine.jav a:198)

at
com.avaje.ebeaninternal.server.query.DefaultOrmQueryEngine.findMany(Default OrmQueryEngine.java:104)

at
com.avaje.ebeaninternal.server.core.OrmQueryRequest.findList(OrmQueryReques t.java:344)

at
com.avaje.ebeaninternal.server.core.DefaultServer.findList(DefaultServer.ja va:1469)

at
com.avaje.ebeaninternal.server.querydefn.DefaultOrmQuery.findList(DefaultOr mQuery.java:906)

at
com.avaje.ebeaninternal.util.DefaultExpressionList.findList(DefaultExpressi onList.java:201)

at models.AP_Uptime.pageUptimeDiff(AP_Uptime.java:115)

at controllers.APs.getUptimeDiffBetweenJobs(APs.java:80)

at
Routes$$anonfun$routes$1$$anonfun$apply$71$$anonfun$apply$72.apply(routes_r outing.scala:452)

at
Routes$$anonfun$routes$1$$anonfun$apply$71$$anonfun$apply$72.apply(routes_r outing.scala:452)

at
play.core.Router$HandlerInvoker$$anon$5$$anon$1.invocation(Router.scala:109 0)

at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33)

at play.GlobalSettings$1.call(GlobalSettings.java:57)

at
be.objectify.deadbolt.actions.RestrictionsAction.applyRestriction(Restricti onsAction.java:41)

at
be.objectify.deadbolt.actions.AbstractRestrictiveAction.call(AbstractRestri ctiveAction.java:44)

at play.core.j.JavaAction$class.apply(JavaAction.scala:74)

at play.core.Router$HandlerInvoker$$anon$5$$anon$1.apply(Router.scala:1089)

at
play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:1 26)

at
play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:1 26)

at play.utils.Threads$.withContextClassLoader(Threads.scala:17)

at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125)

at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115)

at akka.actor.Actor$class.apply(Actor.scala:318)

at play.core.ActionInvoker.apply(Invoker.scala:113)

at akka.actor.ActorCell.invoke(ActorCell.scala:626)

at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197)

at akka.dispatch.Mailbox.run(Mailbox.scala:179)

at
akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(Abstra ctDispatcher.scala:516)

at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259)

at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)

at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479)

at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Roper  
View profile  
 More options Nov 15 2012, 6:01 pm
From: James Roper <jrop...@gmail.com>
Date: Thu, 15 Nov 2012 15:01:14 -0800 (PST)
Local: Thurs, Nov 15 2012 6:01 pm
Subject: Re: [2.04 Java] PersistenceException when using Ebean not()

You might find better help on the ebean mailing list, but can you show your
AP_Uptime class?

Also, what happens when you remove the findList() call from the inner
query?  Expr.in() accepts a query, and so can be implemented using a nested
select in the database, which would be much faster than doing two queries
like you're doing below.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Womer  
View profile  
 More options Nov 15 2012, 7:17 pm
From: Dave Womer <dave.wo...@gmail.com>
Date: Thu, 15 Nov 2012 16:17:27 -0800 (PST)
Local: Thurs, Nov 15 2012 7:17 pm
Subject: Re: [2.04 Java] PersistenceException when using Ebean not()

Thanks James,

When I remove the .toList() I need to replace it with .query() to take,
which ends up looking like this:

find.where().eq("job_id", firstJobId).where().not(Expr.in("ap_mac",find
.where().eq("job_id", secondJobId).query())).findList();

When I run that code, I get this error: javax.persistence.PersistenceException:
Query threw SQLException:Subquery is not a single column query; SQL
statement:

Which makes sense.  I need to look at only the ap_mac field to find what
I'm looking for, but I haven't figured out how to query a single column
with Ebean.

The relevant AP_Uptime class looks like this:

@Entity

public class AP_Uptime extends Model{

 @Id

public Long Id;

 public long upTime;

 public long assocTime;

     @ManyToOne(optional=false)

    public Job job;

    @ManyToOne

    public WLC wlc;

    @ManyToOne(cascade = CascadeType.ALL, optional=false)

    @JoinColumn(name="ap_mac",referencedColumnName="mac_address")

    public AP ap;

 public static Model.Finder<Long,AP_Uptime> find = new Model.Finder(Long.
class, AP_Uptime.class);

 public static List<AP_Uptime> all() {

return find.all();

}

 public AP_Uptime(long uptime, long assocTime){

this.upTime = uptime;

this.assocTime = assocTime;

}

...

...

...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Womer  
View profile  
 More options Nov 15 2012, 7:30 pm
From: Dave Womer <dave.wo...@gmail.com>
Date: Thu, 15 Nov 2012 16:30:27 -0800 (PST)
Local: Thurs, Nov 15 2012 7:30 pm
Subject: Re: [2.04 Java] PersistenceException when using Ebean not()

Nevermind - I did get the single query to work using .select("column_name")
and that appears to have solved the issue with the exception.  Here's what
I ended up with:

find.where().eq("job_id", firstJobId).where().not(Expr.in("ap_mac",find
.select("ap.mac").where().eq("job_id", secondJobId).query())).findList();

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »