473,386 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

incomparable types: java.lang.string and int

I wanted to ask about the code that I have made if either variable or any of ... thank you ...
"incomparable types: java.lang.string and int"
Expand|Select|Wrap|Line Numbers
  1.  if(StringUtils.isNullOrEmpty(txtIdPemesanan.getText())){
  2.         JOptionPane.showMessageDialog(null, "ID pemesanan tidak boleh kosong", "Larangan", JOptionPane.ERROR_MESSAGE);
  3.     }else{
  4.         pemesanan = pemesananController.findPemesanan(txtIdPemesanan.getText());
  5.         if (pemesanan.getIdPemesanan()== 0) {
  6.             JOptionPane.showMessageDialog(null, "Data yang dicari tidak ada!");
  7.         }else{
  8.         txtIdMarketing.setText(pemesanan.getMarketingIdmarketing()+"");
  9.         jDatePemesanan.setDate(pemesanan.getTanggal());
  10.         txtIdCustomer.setText(pemesanan.getCustomerIdcustomer()+"");
  11.  
  12.         CustomerJpaController customerController = new CustomerJpaController(emf);
  13.         Customer customer = customerController.findCustomer(pemesanan.getCustomerIdcustomer());
  14.         txtNamaCustomer.setText(customer.getNmCustomer());
  15.  
  16.         DetilbarangJpaController detilBarangController = new DetilbarangJpaController(emf);
  17.             javax.persistence.Query namedQuery = detilBarangController.getEntityManager().createNamedQuery("Detilbarang.findByPemesananIdPemesanan");
  18.         namedQuery.setParameter("pemesananIdPemesanan", pemesanan.getIdPemesanan());
  19.         List<Detilbarang> listDetilBarang = namedQuery.getResultList();
  20.         DefaultTableModel model = (DefaultTableModel) tblDetilBarang.getModel();
  21.         int i = 0;
  22.         while (i < tblDetilBarang.getRowCount()){
  23.             model.removeRow(i);

thanks for helpme...... :)
Sep 21 '12 #1
1 4096
PreethiGowri
126 64KB
i guess you are comparing a string with integer value 0
if you want to compare a string then use,

pemesanan.getIdPemesanan() == null
Nov 6 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Min-Koo Seo | last post by:
Hi. I have a java stored procedure whose spec is as follows: CREATE OR REPLACE FUNCTION DECODE_SEQUENCE(SEQUENCE VARCHAR2) RETURN VARCHAR2 DETERMINISTIC AS LANGUAGE JAVA NAME...
1
by: vbdotnetmania | last post by:
Hi, I'm trying to port java code to c#, I am not too familiar with either so forgive me for what might be a stupid question, I wish to use the java string type rather than the c# one, when I try to...
0
by: snkssa | last post by:
Hi, I got the following error while building an application with ant. please can you give the solution or reason why it is failing? Thank you create_zip_linux: ...
3
by: vakon | last post by:
class Search { public static void main (String args) { int position; int counter = 0; String para; para = Keyin.inString("insert a paragraph");
1
by: rainman33 | last post by:
I am getting this error message in the program I'm working on (line 150), and am wondering what it means? This is an exercise for a college class; just want to declare that; this is not my own work....
5
by: creative1 | last post by:
hi, I am new at writing JSP and Servlets. When I compile my serverlet I get follwoing error cannot find mymbol method parseDate(java.lang.String) I have follwoing code: Code: ( text )...
1
by: onlinegear | last post by:
HI i am writing this for college i know i have loads of combo boxes with nothing in the i havent got that far yet. but every time i run this is comes up with this erro run: Exception in thread...
4
by: BurnTard | last post by:
Okay, new programming language for Burnie. Can anyone tell me how to write a try catch statement for incomparable types? I can't figure out how to get emacs to give me the actual error, and not the...
1
by: ahmee | last post by:
this my program code these are my errors below please help me out....guys operater % cannot be applied to java.lang.String.int operater / cannot be applied to java.lang.String.int operater +...
1
by: phpuser123 | last post by:
Here are the codes I just compiled in java and I am getting a java.lang.ClassCastException ... import java.io.FileInputStream; import java.io.FileNotFoundException; import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.