--- vieraci <
vince@...> wrote:
>
> This statement:
>
> Statement stmt = myConn.createQuery();
>
> I get this error in the popup where the red (!) is displayed to the left of
> the statement in the Netbeans 6.1 IDE
>
> createQuery(java.lang.string) in javax.persistence.EntityManager cannot be
> applied to incompatible types
> Found javax.persistence.EntityManager.createQuery
> required: com.mysql.jdbc.Statement
>
> Driver is mysql-connector-java-5.1.5 (Revision ${svn revision})
> myConn is an EntityManager bean
> Even if I give the complete name (com.mysql.jdbc.Statement stmt = ) is same
> error.
>
> Why is this so ?
>
Please read the descriptions of the forums when posting in Nabble. This list is for development
of the NetBeans IDE. Your issue is caused by the fact that Query is not a Statement. You need to
be using the correct APIs together. See the regular JavaDocs in the JDK for package java.sql and
then see the EE JavaDocs and see javax.persistence. What you are doing is the same as one trying
to do this:
java.sql.Connection con = new String("hello");
It just doesn't work nor make sense. I'm just getting to the point that this is a regular Java or
any other language rule, and not trying to be rude...could seem that way. The types must match.
Wade
==================
Wade Chandler, CCE
Software Engineer and Developer, Certified Forensic Computer Examiner, NetBeans Dream Team Member, and NetBeans Board Member
http://www.certified-computer-examiner.comhttp://wiki.netbeans.org/wiki/view/NetBeansDreamTeamhttp://www.netbeans.org