This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 203361 - [71cat] use
Summary: [71cat] use
Status: RESOLVED INVALID
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-08 13:51 UTC by muellermi
Modified: 2011-11-16 16:40 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages (67.36 KB, text/plain)
2011-10-08 13:56 UTC, muellermi
Details
dump (94.61 KB, text/plain)
2011-10-08 13:57 UTC, muellermi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description muellermi 2011-10-08 13:51:57 UTC
Product Version = NetBeans IDE Dev (Build 201110070600)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0
Runtime = Java HotSpot(TM) 64-Bit Server VM 21.0-b17

- insert code
- Use entity manager

worked fine for the first time
and generated expected

@PersistenceContext(unitName="WebAppJUnitPU")
private EntityManager em;

(as part of the tuturial "testing unins embedded container)

After a problem, I changed some code. 
No, NB marks em as wrong. 
I deleted this code and tried to re-insert as abocve.
NetBeans generated this code instead:

    public void persist(Object object) {
        /* Add this to the deployment descriptor of this module (e.g. web.xml, ejb-jar.xml):
         * <persistence-context-ref>
         * <persistence-context-ref-name>persistence/LogicalName</persistence-context-ref-name>
         * <persistence-unit-name>WebAppJUnitPU</persistence-unit-name>
         * </persistence-context-ref>
         * <resource-ref>
         * <res-ref-name>UserTransaction</res-ref-name>
         * <res-type>javax.transaction.UserTransaction</res-type>
         * <res-auth>Container</res-auth>
         * </resource-ref> */
        try {
            Context ctx = new InitialContext();
            UserTransaction utx = (UserTransaction) ctx.lookup("java:comp/env/UserTransaction");
            utx.begin();
            EntityManager em = (EntityManager) ctx.lookup("java:comp/env/persistence/LogicalName");
            em.persist(object);
            utx.commit();
        } catch (Exception e) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", e);
            throw new RuntimeException(e);
        }
    }


BTW NetBeans behavior nor is abnormal.
I inserted the code above by copy and paste.
In the meantime I copied and pasted some other code outside of NB.
Pasting here (or in NB editor) will still paste the same olld text :(
I really don't know what happened.
Sorry, I don't know how to reproduce it. The only thing I'm able to do, is to add some logs.

And, just now, after _cutting_ and copying, clipboard is ok inside NB works again. 
Dubious...
Comment 1 muellermi 2011-10-08 13:56:12 UTC
Created attachment 111705 [details]
messages
Comment 2 muellermi 2011-10-08 13:57:14 UTC
Created attachment 111706 [details]
dump
Comment 3 muellermi 2011-10-08 14:06:22 UTC
Oops, I tried to insert into the entity instead of the bean. My fault. Thus I close this issue.
The only dubious thing is the behavior of the clipborad...