Netbeans' JPQL autocomplete feature - netbeans

I'm currently using Netbeans 8.1 as my default IDE and it has the nice ability of auto-complete the JPQL queries when I CTRL space an object inside the query string, but only whether the query string is a single-lined one. If you break the query in two or more lines to fit in your screen (e.g. 128 columns) it stops auto-completing.
For instance:
-- Here the auto-complete happens properly
"SELECT p FROM Product p JOIN FETCH p.skus skus";
-- Here it doesn't
"SELECT p FROM Product p "
+ "JOIN FETCH p.skus skus";
Any help will be appreciated.

This is still an open item on the NetBeans bug tracker since version 7.2 of the software. The last comments there suggest that it should be fixed in 8.2, but it is still not, so you can take this to the bug tracker page and kindly ask Sergey Petrov to give this issue a higher priority.
Perhaps Eclipse has some tools, like the Hibernate Tools plugin, that can help you with this if you are willing to switch to Eclipse.
Or give IntelliJ IDEA a try with their JPA Console tool.

Related

Eclipse autocomplete problems

I use Map a lot in Java with eclipse. e.g.
Map<String, String> map = new HashMap<>();
then when I am ready to add something with put:
String key = null;
String value = null;
// somewhere before the put, key and value get populated with Strings
map.put(key, value);
the problem is, every time I type "map.put", Eclipse autocomplete changes it to "map.compute()" so I have to edit and remove the "com" and the "e".
I looked at Window -> preferences -> Java -> Editor -> Content Assist but nothing was apparent. I could, I suppose, turn off all content assist, but that would be like "throwing the baby out with the bath water". There are a lot of useful things in the content assist.
My Eclipse:
Eclipse IDE for Enterprise Java Developers.
Version: 2018-12 (4.10.0)
Build id: 20181214-0600
OS: Windows 10, v.10.0, x86_64 / win32
Java version: 1.8.0_144
How can I fix eclipse so it will make the correct suggestions like it did in previous versions?
None of the proposed solutions worked for me. What fixed it was to disable "Show substring matches" (in Preferences -> Java -> Editor -> Content Assist).
It should be considered that this will break the functionality to just type a random part of the desired reference, e.g. typing "PreparedStatement" no longer leads to OraclePreparedStatement. A feature that I don't care about, but this is obviously a matter of personal preference.
In my opinion, the name of that option is a slight misnomer since the substring aspect only applies to leading and not to trailing content.
Update: In Eclipse 2020-06, there is no longer an option "Show substring matches". In its place there is "Show subword matches", but even when disabled, suggestions for typing map.put still include compute. At least when sorted by relevance rather than alphabetically, put is listed in the suggestions before compute.
Window->Preferences
Java->Editor->Content Assist->Advanced
Unchecking "Java Proposals (Task-Focused)" and instead checking regular "Java Type Proposals" fixed the problem for me. I'm using Eclipse for Enterprise Java Developers 2019-03 on Windows 10.
This appears to be due to the unfortunate decision to remove 'Code Recommenders' going forward from 2018-12
"... Code Recommenders will unfortunately not make it into 2018-12."
https://bugs.eclipse.org/bugs/show_bug.cgi?id=542689
The solution currently is to add it manually from the marketplace.
Help -> Eclipse Marketplace -> Search for 'Code Recommenders'
There are no guarantees it will work for Java 11+.
Once installed, you'll have to:
restart Eclipse
close the 'Autocomplete installed' information page
attempt autocomplete once and select the top option that's something like 'Autocomplete enabled'
Finally attempt autocomplete again, this time it should work as expected
Update: It appears Code Recommenders has been archived due to lack of maintainers. When you try to download it, you will get a 404. Hopefully this is temporary.

Debug Watch Expression: How to customize the display of an object in Eclipse

In Eclipse's watch window ("Expressions"), is there a way to have eclipse interpret the contents of a class/structure, rather than having to open the tree? Currently the "value" for any class/structure is {...}, and opening it consumes multiple lines in the Expressions window.
i.e, suppose I have a class complex with real and imag.
class complex_t {
double real, imag;
}
Is there an XML file somewhere in eclipse to indicate that complex_t should display the values for .real and .imag instead of {...}? I've been searching on Visualizers, but I think that is something else.
Visual Studio, had this functionality say 10 years ago or so and I found it very handy (autoexp.dat). I don't use VS anymore but I think it might now be called Native Visualizer (NatVis). I even found that that Boost provides these XML files to visualizing objects in their library. (https://svn.boost.org/trac/boost/wiki/DebuggerVisualizers). No mention of Eclipse, which is an indication that the answer is no.
Edit: I'm looking for a solution for C/C++ (specifically for Code Composer Studio actually).
Below josivan does have a solution for Java though.
If you want to show details during debug you can do something like
Window > Preferences > Java > Debug > Detail Formatters
Click in Add, Choose your class. In area "Detail formatter code snippet" you define what you want. For example:
return "[r: " + real + ", i: " + imag + "]";
On debug Perpective you can see details of your class.
Take a look in the imagem bellow.
In eclipse help you can get more details. And here are a good article about it.

I get errors when typing the #SidedProxy. What happened?

I am making a Minecraft Mod with Eclipse Mars and I got errors when typing the following:
#SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
What did I do wrong? It said "the attribute clientSide/serverSide is undefined for the annotation type SidedProxy" .
I cannot run Minecraft to test my mod without it, so I need to fix this error.
For a definitive answer you need to give us more information.
What version of minecraft forge are you using?
Have you correctly imported SidedProxy?
In eclipse, hold ctrl and click on #SidedProxy to open where it is declared, and check that you are using the correct attribute names (it may have changed between versions, so you may need to put something different)

What is the best process for updating sugarcrm?

I have a client that has SugarCRM 5.5.4 in production with many customizations. I tried updating (5.5.4 > 6.1.0 > 6.2.5 > 6.2.6) and had problems in Studio (6.2.5), ModuleLoader and even Updater (6.2.6) after that.
Now I've set up a new 6.5.7 installation and updated all the modules to work properly in that.
What is the best way now to migrate the data from an old version of sugar into a new one?
I worked with Talend but it wasn't that effective (too much time lost). Now I just migrate the tables like this:
INSERT INTO 657.notes (
`assigned_user_id`, `id`, `date_entered`, `date_modified`, `modified_user_id`,
`created_by`, `name`, `file_mime_type`, `filename`, `parent_type`, `parent_id`,
`contact_id`, `portal_flag`, `embed_flag`, `description`, `deleted`
)
SELECT
`assigned_user_id`, `id`, `date_entered`, `date_modified`, `modified_user_id`,
`created_by`, `name`, `file_mime_type`, `filename`, `parent_type`, `parent_id`,
`contact_id`, `portal_flag`, `embed_flag`, `description`, `deleted`
FROM `554`.notes
I was wondering how others do and what the best practice would be?
That should work fine; note you'll probably want to do a Quick Rebuild and Repair afterwards to make sure the database is all correct.

Updating Jira Plugin from Version 3 to Version 4, Replacing SearchParameter

i am pretty new to Jira Development so please be patient
I should upgrade a Plugin that worked with Jira Version 3 to work with Jira Version 4
Most of the thins went pretty well, but now i am kind of stuck
The SearchParameter and the ProjectParameter Class are not available in the new Version and i dont exacly know how to replace them. its really just this few lines of code, where its needed
these Classes are outdated: SearchParameter and ProjectParameter
i looked in the jira doc buts its seems pretty complicated, you would do me a great favor if you could help me
SearchRequest sr = srs.getFilter(ctx, filterId);
...
SearchParameter param = sr.getParam(new ProjectParameter().getName());
...
List columns = columnLayout
.getVisibleColumnLayoutItems(user,
param.getValues(), Collections.EMPTY_LIST);
It would even Help if you could explain what the seccond Line intends
Thanks in advance
I can't help you rewrite the plugin entirely, but I can try help you decipher what those quoted lines of code mean:
SearchRequest sr = srs.getFilter(ctx, filterId);
This line loads a saved SearchRequest with the corresponding filterId.
SearchParameter param = sr.getParam(new ProjectParameter().getName());
This line gets the Project search parameter that was saved in the SearchRequest. As you may know, SearchRequests (or saved filters if you prefer) all you to save a search from JIRA with parameters defined. One possible parameter to define is a ProjectParameter. So if your search is "all issues in project X", then you would have a SearchParameter in your SearchRequest which is a ProjectParameter that knows to search for project X.
List columns = columnLayout
.getVisibleColumnLayoutItems(user,
param.getValues(), Collections.EMPTY_LIST);
This line retrieves the ColumnLayoutItems which are visible to the specified user, for the specified projects of the SearchRequest (by extracting the value from the ProjectParameter of the SearchRequest as retrieved in line 2).
It's a bit unclear what this code is attempting to do without more context, but that's what those lines are doing anyway. You might find the API documentation useful:
http://docs.atlassian.com/jira/3.13/
http://docs.atlassian.com/jira/3.13/com/atlassian/jira/issue/fields/layout/column/ColumnLayout.html