我想建立以下伪查询
Select a From APDU a where a.group.id= :id
group是APDUGroup.class类型的APDU类中的字段。
我只想基于APDUGroup的ID获取APDU的列表。
如何使用标准的JPA查询来做到这一点?
更新
是的,在发布到S / O之前,我已经尝试了上述查询并尝试了数小时的其他变体。这是上面查询生成的SQL:
SELECT t1.ID, t1.status, t1.type, t1.modified, t1.response, t1.expectedSize, t1.created, t1.description, t1.sequence, t1.name, t1.command, t1.recurring, t1.auth, t1.createdBy, t1.APDUGroup, t1.modifiedBy FROM APDUGroup t0, APDU t1 WHERE ((t0.ID = ?) AND (t0.ID = t1.APDUGroup))
Run Code Online (Sandbox Code Playgroud)
该查询看起来还可以,但是没有从我的表中选择任何内容。我的测试数据库中至少有100个APDUGroup = 1的APDU。
我正在使用eclipselink作为JPA提供程序。
我想为一些泛型类创建很多扩展方法,例如
public class SimpleLinkedList<T> where T:IComparable
Run Code Online (Sandbox Code Playgroud)
我已经开始创建这样的方法:
public static class LinkedListExtensions
{
public static T[] ToArray<T>(this SimpleLinkedList<T> simpleLinkedList) where T:IComparable
{
//// code
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我试图使LinkedListExtensions类像这样通用时:
public static class LinkedListExtensions<T> where T:IComparable
{
public static T[] ToArray(this SimpleLinkedList<T> simpleLinkedList)
{
////code
}
}
Run Code Online (Sandbox Code Playgroud)
我得到"扩展方法只能在非泛型,非嵌套的静态类中声明".
而我正在试图猜测这种限制来自哪里并且没有任何想法.
编辑:仍然没有明确的问题愿景.似乎这只是因为某种原因没有实现.
我有一个自定义列表适配器:
class ResultsListAdapter extends ArrayAdapter<RecordItem> {
Run Code Online (Sandbox Code Playgroud)
在重写的'getView'方法中,我做了一个打印来检查它是什么位置以及它是否是convertView:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
System.out.println("getView " + position + " " + convertView);
Run Code Online (Sandbox Code Playgroud)
此输出(当列表首次显示时,尚未输入用户)
04-11 16:24:05.860: INFO/System.out(681): getView 0 null
04-11 16:24:29.020: INFO/System.out(681): getView 1 android.widget.RelativeLayout@43d415d8
04-11 16:25:48.070: INFO/System.out(681): getView 2 android.widget.RelativeLayout@43d415d8
04-11 16:25:49.110: INFO/System.out(681): getView 3 android.widget.RelativeLayout@43d415d8
04-11 16:25:49.710: INFO/System.out(681): getView 0 android.widget.RelativeLayout@43d415d8
04-11 16:25:50.251: INFO/System.out(681): getView 1 null
04-11 16:26:01.300: INFO/System.out(681): getView 2 null
04-11 16:26:02.020: INFO/System.out(681): getView 3 null
04-11 16:28:28.091: INFO/System.out(681): getView 0 …Run Code Online (Sandbox Code Playgroud) 当我跑蚂蚁时,它说:
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
Run Code Online (Sandbox Code Playgroud)
我可以用什么软件包下载所需的文件> C:\ Program Files\Java\jre6\lib\tools.jar
我刚刚下载了这个:
JRE-6u19-Windows的i586系统,s.exe
但遗憾的是它似乎不在它上面......
有什么办法可以让一个线程分支到它自己的独立进程中吗?我知道有 CreateProcess 函数,但据我所知,您只能用它运行外部应用程序。我所要求的到底有可能吗?
我找到了这个教程,这很好,但对我不起作用!
这是代码:
- (void)listenForBlow:(NSTimer *)timer {
[recorder updateMeters];
const double ALPHA = 0.05;
double peakPowerForChannel = pow(10, (0.05 * [recorder peakPowerForChannel:0]));
lowPassResults = ALPHA * peakPowerForChannel + (1.0 - ALPHA) * lowPassResults;
if (lowPassResults > 0.95)
NSLog(@"Mic blow detected");
//change the background color e.g !
}
Run Code Online (Sandbox Code Playgroud)
在控制台中向我展示这样的nslog研究(没有任何保龄球!):
2010-04-11 23:32:27.935 MicBlow[2358:207] Mic blow detected
2010-04-11 23:32:27.965 MicBlow[2358:207] Mic blow detected
2010-04-11 23:32:27.995 MicBlow[2358:207] Mic blow detected
2010-04-11 23:32:28.026 MicBlow[2358:207] Mic blow detected
2010-04-11 23:32:28.055 MicBlow[2358:207] Mic blow detected
2010-04-11 …Run Code Online (Sandbox Code Playgroud) 我认为这是一个非常简单的问题.
如何重写apache以隐藏文件夹.
EX:www.website.com/pages/login.php到www.website.com/login.php
或www.website.com/pages/home.php至www.website.com/home.php
该文件夹总是需要隐藏.谢谢
我想用Gravity或margin将ImageView添加到FrameLayout.但FramLayout和ImageView没有相关的方法(实际上,我找不到).选择Framelayout的原因是将ImageView放在ImageView上.
帮帮我吧.找到解决方案对我来说是紧急的.
谢谢.
以下是我的代码,有助于理解我的问题.
FrameLayout imageFrame = new FrameLayout(mContext);
imageFrame.setLayoutParams(new GridView.LayoutParams(158, 158));
ImageView frame = new ImageView(mContext);
frame = new ImageView(mContext);
frame.setLayoutParams(new LayoutParams(158, 158));
frame.setScaleType(ImageView.ScaleType.CENTER_CROP);
frame.setImageResource(R.drawable.image_frame_n);
ImageView image = new ImageView(mContext);
image.setLayoutParams(new LayoutParams(148, 148));
image.setScaleType(ImageView.ScaleType.CENTER_CROP);
image.setImageResource(mThumbIds[position]);
// image is needed to have a margin or gravity to be positioned at center of imageFrame
imageFrame.addView(image);
imageFrame.addView(frame);
Run Code Online (Sandbox Code Playgroud) 我习惯用老式图书馆处理图形(allegro,GD,pygame),如果我想将一个位图的一部分复制到另一个......我只是使用blit.
我想弄清楚如何在android中做到这一点,我感到非常困惑.那么......我们将这些Canvas设置为只写,Bitmaps是只读的吗?看起来真是太愚蠢了,必须有一些我想念的东西,但我真的无法理解.
编辑:更精确一点...... 如果位图是只读的,而且画布只是写入的,我不能将A插入B,然后将B插入C?
我有一个使用Chrome浏览器等标签的应用程序.现在我希望能够打开更多表格而不仅限于一种表格.这些表格应该是相同的,但如果我关闭主表格,所有表格都将被关闭.如何使所有表格都相同,所以无论我关闭哪种表格,只关闭该表格而不是在所有表格关闭之前退出申请表?有任何想法吗?
亲切的问候Roy M Klever