我得到以下错误
org.hibernate.HibernateException: No Session found for current thread
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:97)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1024)
at com.fexco.shoptaxfreemobile.service.ProfileService.registerVisitor(ProfileService.java:57)
at com.fexco.shoptaxfreemobile.controller.ProfileController.registerVisitor(ProfileController.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.fexco.shoptaxfreemobile.jsonp.JsonpCallbackFilter.doFilter(JsonpCallbackFilter.java:33)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at …Run Code Online (Sandbox Code Playgroud) 我有一个类Shop与以下变量
@Column(columnDefinition = "bit")
private boolean atShop;
Run Code Online (Sandbox Code Playgroud)
使用此值,我使用HSQL从应用程序中检索此信息
from Person person
left join fetch person.shop
Run Code Online (Sandbox Code Playgroud)
当我尝试调用此HSQL语句时,我收到以下错误
org.springframework.orm.hibernate3.HibernateSystemException: could not set a field value by reflection setter of com.test.dataobject.Shop.atShop; nested exception is org.hibernate.PropertyAccessException: could not set a field value by reflection setter of com.test.dataobject.Shop.atShop
Run Code Online (Sandbox Code Playgroud)
这是因为它试图在HSQL中将布尔值设置为null.我可以通过改变private boolean atShop;来解决这个问题,private Boolean atShop;但我想保持这个,boolean因为我将它保存在我的数据库中
有没有办法解决这个问题不改变的方式boolean来Boolean?
编辑:
我知道布尔值只能是true/false而布尔值可以设置为null,但有没有办法让hibernate/spring将此值设置为false(我认为它应该自动执行)而不是尝试将其设置为null并抛出此异常?
我还尝试添加注释以自动将值设置为false,但这也不起作用
@Column(nullable = false, columnDefinition = "bit default 0")
private boolean atShop;
Run Code Online (Sandbox Code Playgroud) 看来这里有什么问题?我该如何解决?
错误"视图无法解析为类型"
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
Object o = my_listview.getItemAtPosition(position);
// write you handling code like...
String st = "sdcard/";
File f = new File(st+o.toString());
// do whatever u want to do with 'f' File object
Log.d("The position fo f:",o.toString());
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我知道这是一个经常被问到的问题,但我一直在寻找一个解决我的问题的解决方案,从昨天开始,我一直无法找到!
我正在使用Eclipse Helios和Tomcat 6.0.2,当我尝试使用tomcat和eclipse调试我的代码时我得到了错误Source not found,即使是我自己编写的代码也是如此,而不仅仅是所有的jar文件
我正确地设置了java构建路径,我也使用jdk1.6.0并且也正确设置了这不是问题,如果我右键单击调试控制台,它确实在我调试时显示代码去Edit Source Lookup....因为这将显示仅用于调试器运行的源代码,所以当进入Run -> Debug Configurations和在Java Application窗口中我将其设置为使用Tomcat时,在source选项卡中我添加了我的项目和所有jar文件,但这也不起作用!当我再次调试并进入Edit Source Lookup...它时,它没有显示我保存在那里的项目和jar文件
有没有人有任何想法可能会发生什么?
我正在使用eclipse创建一个Android应用程序,该应用程序获取手机上所有当前显示的应用程序的列表,但我收到的错误是我以前从未见过的.我的代码看起来正确,但在其中一个"}"括号中我得到错误"语法错误,插入"最后"完成TryStatement",有没有人知道如何解决这个错误?
谢谢.
我有一个包含3列的数据库表:id,name,permission.
它看起来像这样:
1漫画乐趣
2沟通谈话
3漫画手表
我试图获得漫画名称的许可.我在我的数据库类(AppData.java)中使用以下代码:
private final static String DB_NAME = "safety_app_database"; // the name of our database
private final static int DB_VERSION = 1; // the version of the database
// the names for our database columns
private final String TABLE_NAME = "permissions_table";
private final String ID = "id";
private final String NAME = "name";
private final String PERMISSION = "permission";
Run Code Online (Sandbox Code Playgroud)
和方法
public Cursor getData(){
return db.rawQuery("SELECT permission FROM permissions_table WHERE name = 'Comics', null);
}
Run Code Online (Sandbox Code Playgroud)
我在我的主类(safety.java)中调用它.AppData引用AppData.java
appData.getData(); …Run Code Online (Sandbox Code Playgroud) 这是我目前的代码,但我仍然无法获得手机上所有应用的列表.有谁看到我做错了什么?
public class GetAppList extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
List<PackageInfo> appListInfo1 = this.getPackageManager()
.getInstalledPackages(0);
JSONArray ja = new JSONArray();
try {
HttpClient httpclient = new DefaultHttpClient();
Object sendDataUrl = null;
HttpPost request = new HttpPost(sendDataUrl.toString());
List<NameValuePair> params = new ArrayList<NameValuePair>();
ContextWrapper context = null;
PackageManager pm = context.getPackageManager();
List<PackageInfo> appListInfo = pm.getInstalledPackages(0);
for (PackageInfo p : appListInfo) {
if (p.applicationInfo.uid > 10000) { …Run Code Online (Sandbox Code Playgroud) 我在excel中有以下公式
=CONCATENATE("insert into #UpdateData (mondayopenhour, mondayopenmin,mondayclosehour, mondayclosemin,tuesdayopenhour, tuesdayopenmin,tuesdayclosehour, tuesdayclosemin,wednesdayopenhour, wednesdayopenmin, wednesdayclosehour, wednesdayclosemin,thursdayopenhour, thursdayopenmin,thursdayclosehour, thursdayclosemin, fridayopenhour, fridayopenmin, fridayclosehour, fridayclosemin, saturdayopenhour, saturdayopenmin, saturdayclosehour, saturdayclosemin, sundayopenhour, sundayopenmin, sundayclosehour, sundayclosemin values ('",TRIM(A2),"',",MID(B2,1,2),",",MID(B2,3,2),",",MID(C2,1,2),",",MID(C2,3,2),",",MID(D2,1,2),",",MID(D2,3,2),",",(MID(E2,1,2),",",MID(E2,3,2),",",MID(F2,1,2),",",MID(F2,3,2),",",MID(G2,1,2),",",MID(G2,3,2),",",MID(H2,1,2),",",MID(H2,3,2),",",MID(I2,1,2),",",MID(I2,3,2),",",MID(J2,1,2),",",MID(J2,3,2),",",MID(K2,1,2),",",MID(K2,3,2),",",MID(L2,1,2),",",MID(L2,3,2),",",MID(M2,1,2),",",MID(M2,3,2),",",MID(N2,1,2),",",MID(N2,3,2),",",MID(O2,1,2),",",MID(O2,3,2),")")
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我收到以下错误
公式中的文本值限制为255个字符.要在公式中创建长度超过255个字符的文本值,请使用CONCATENATE函数或连接运算符(&).
我一直在网上查找,但没有真正的解决方案!有谁知道如何解决这个问题?
我正在研究一个项目,它将涉及我的项目编译足够简单的java文件.根据我的研究,我决定不尝试构建自己的编译器,因为这只需要花费太多时间.
那么有谁知道在这个项目中实现的最佳编译器是什么,以便我能够编译提交给程序的java文件?
我在excel中有两个不同的工作表,在所有第1行单元格中都有相同的标题(a1 = id,b1 = name,c1 = price).我的问题是,有没有办法将数据(如名称)从1个工作表导入到另一个工作表中"id"相同的另一个工作表中.
eg.
sheet 1 sheet2
ID Name Price ID Name Price
xyz Bag 20 abc 15
abc jacket 15 xyz 20
Run Code Online (Sandbox Code Playgroud)
那么有没有办法在表格1中将"名称"添加到表2中的"名称"中,其中表1中的"ID"=表2中的"ID"?
没有应对和粘贴当然谢谢