Talk:LiveDB

From APIDesign

(Difference between revisions)
Jump to: navigation, search
Current revision (09:39, 3 April 2013) (edit) (undo)
(Comment provided by Mircea - via ArticleComments extension)
 
(19 intermediate revisions not shown.)
Line 26: Line 26:
Thanks.
Thanks.
-
Do you mean that processor should be in a different package or project? I am just not clear on what you mean. I apologize.
+
That is good advice. I did as you suggested.
Cheers!
Cheers!
Line 32: Line 32:
--Russ White 22:13, 31 August 2010 (CEST)
--Russ White 22:13, 31 August 2010 (CEST)
 +
</div>
 +
== Russ White said ... ==
 +
 +
<div class='commentBlock'>
 +
Completions questions.
 +
 +
If you put a package-info.java such as the one in the test source package into the regular source package of a new project which wants to make use of the processor (and it's static and dynamic completions), the getCompletions method on the processor is never called. The processor still works at compile time, but the use of the annotation in the editor seems to be limited to the test packages. Can you explain why this happens?
 +
 +
Here is what I implemented to test:
 +
 +
@Override
 +
public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
 +
Logger.getLogger(FooProcessor.class.getName()).info("Completion.....");
 +
return Collections.singleton(Completions.of("Test"));
 +
}
 +
 +
It gets called and works fine when editing a package-info.java that is in "Test Packages"
 +
 +
The method does not get called at all while editing a copy of the same file in "Source Packages"
 +
 +
I have to admit I am stumped. Any ideas? Is this just a NetBeans bug?
 +
 +
 +
--Russ White 23:30, 4 September 2010 (CEST)
 +
</div>
 +
 +
 +
Hello Russ. You need to have latest development build of NetBeans 6.10 to make proper use of getCompletion method. Moreover the [[AnnotationProcessor]] needs to be compiled before you start to use the [[annotation]]. Preferably you should have your processor in one [[JAR]] file and use it from another project. That is supposed to work OK. The ''Test Packages'' are separate source root (compiled after project sources) and thus are quite similar to the previous example of packaging a [[JAR]] and using it from different project (except the [[JAR]] does not need to be created to work with the test classes). But definitely you can't use the [[AnnotationProcessor]] from among the same sources that define the processor. That would require some kind of incremental parsing and processing and I think that the [[NetBeans]] [[Java]] editor guys are not willing to bother with that.
 +
 +
--[[User:JaroslavTulach|JaroslavTulach]] 05:46, 6 September 2010 (UTC)
 +
 +
== I am using nb 6.10.m1 ==
 +
 +
The project that has the annotation and processor is separate from the example project. I use it as a library in the example. I still only get the completions when writing test source code.
 +
 +
I am pretty sure that is not the desired behavior. I will try a nightly build.
 +
 +
Thanks for the pointers.
 +
== Martin Juranek said ... ==
 +
 +
<div class='commentBlock'>
 +
Whoa, that will get handy.
 +
 +
About philosofical aspects:
 +
I don't think that database schema should be THE source of truth about database and entity classes.
 +
Information contained there is simply not complete, because 1) its relational 2) somtimes you need to do strange things. Considering you can describe everything in java source code (even DB specific things, thanks to annotations), its better to make java source THE source of truth. But some help when writing it and then enforcing it at compile time (annotation saying to verify whether DB schema is compatible with source) would definitely be usefull.
 +
 +
--Martin Juranek 09:14, 12 October 2010 (CEST)
 +
</div>
 +
== Zolta said ... ==
 +
 +
<div class='commentBlock'>
 +
Greetings Jaroslav!
 +
Great stuff I'll use the idea, Thanks!
 +
The update is not automatic
 +
(from 8:24 ) You mention there is an action to get the ide to run the annotation processors available.
 +
Which one is that? I can't seem to get the IDE to run the annotation processor.
 +
 +
--Zolta 01:51, 5 December 2010 (CET)
 +
</div>
 +
== Zolta said ... ==
 +
 +
<div class='commentBlock'>
 +
already answered (partly)
 +
will that be available after 6.9.1 and before 7.0
 +
or should I use 7.0 beta if I'm eager to use this?
 +
 +
--Zolta 01:58, 5 December 2010 (CET)
 +
</div>
 +
 +
 +
Hello Zolta, we have not considered this functionality important enough for majority of [[NetBeans]] IDE users, so you have to use 7.0beta (at least). However the more libraries use [[AnnotationProcessor]]s, the more important this kind of IDE support will be. So go on, use the [[LiveDB]] ideas and good luck!
 +
--[[User:JaroslavTulach|JaroslavTulach]] 22:40, 5 December 2010 (UTC)
 +
== Zolta said ... ==
 +
 +
<div class='commentBlock'>
 +
I'd like to get it work but I can't :(
 +
I added some logging to LiveDBProcessor but no clue where the problem might be.
 +
It seems it's ok since The processor runs without error. Could you help me please? see:[[User:Zolta/annotations]]
 +
 +
Question: what is the action you forgot to mention at 8:23 in the video? (To refresh generated Age class after change in AGE Table in DB) What were you doing there?
 +
Thanks in advance
 +
 +
 +
--[http://wiki.apidesign.org/wiki/User:Zolta/ Zolta] 13:29, 6 December 2010 (CET)
 +
</div>
 +
== Amelia said ... ==
 +
 +
<div class='commentBlock'>
 +
me english very bad. I think is wonderful site, good good writing.
 +
~ hey from Poland
 +
 +
--[http://swtorbots.net/swtor-pvp-bot Amelia] 11:50, 11 May 2012 (CEST)
 +
</div>
 +
== Bette said ... ==
 +
 +
<div class='commentBlock'>
 +
Incredible quest there. What occurred after? Take care!
 +
 +
--[http://www.horselinker.com/search.php/all/Deciding%20on%20Immediate%20Programs%20In%20Home%20Remodeling%20-%20Psywiki#Deciding on Immediate Programs In Home Remodeling - Psywiki Bette] 00:42, 21 September 2012 (CEST)
 +
</div>
 +
== Gretchen said ... ==
 +
 +
<div class='commentBlock'>
 +
What's up, just wanted to say, I loved this article. It was inspiring. Keep on posting!
 +
 +
--[http://www.blueaffinity.net Gretchen] 01:04, 12 October 2012 (CEST)
 +
</div>
 +
== Mircea said ... ==
 +
 +
<div class='commentBlock'>
 +
This is so nice. Thanks for sharing.
 +
 +
--Mircea 11:39, 3 April 2013 (CEST)
</div>
</div>

Current revision

Comments on LiveDB <comments />


Contents

Russ White said ...

I was inspired by your article to create a project that would fit the needs I have for a project that requires integration with an existing schema.

http://github.com/AridModel

Thanks so much for your good article.

Cheers! Russ

--Russ White 15:43, 31 August 2010 (CEST)

Nice. I am glad I could motivate someone who understands the project domain. Btw. I'd put the processor into different package than the annotations, so it is not treated as part of the AridModel API. It is an implementation detail, should be hidden to users of the API in some less public part of the API JAR file.

--JaroslavTulach 18:26, 31 August 2010 (UTC)

Russ White said ...

Thanks.

That is good advice. I did as you suggested.

Cheers! Russ

--Russ White 22:13, 31 August 2010 (CEST)

Russ White said ...

Completions questions.

If you put a package-info.java such as the one in the test source package into the regular source package of a new project which wants to make use of the processor (and it's static and dynamic completions), the getCompletions method on the processor is never called. The processor still works at compile time, but the use of the annotation in the editor seems to be limited to the test packages. Can you explain why this happens?

Here is what I implemented to test:

   @Override
   public Iterable<? extends Completion> getCompletions(Element element, AnnotationMirror annotation, ExecutableElement member, String userText) {
       Logger.getLogger(FooProcessor.class.getName()).info("Completion.....");
       return Collections.singleton(Completions.of("Test"));
   }

It gets called and works fine when editing a package-info.java that is in "Test Packages"

The method does not get called at all while editing a copy of the same file in "Source Packages"

I have to admit I am stumped. Any ideas? Is this just a NetBeans bug?


--Russ White 23:30, 4 September 2010 (CEST)


Hello Russ. You need to have latest development build of NetBeans 6.10 to make proper use of getCompletion method. Moreover the AnnotationProcessor needs to be compiled before you start to use the annotation. Preferably you should have your processor in one JAR file and use it from another project. That is supposed to work OK. The Test Packages are separate source root (compiled after project sources) and thus are quite similar to the previous example of packaging a JAR and using it from different project (except the JAR does not need to be created to work with the test classes). But definitely you can't use the AnnotationProcessor from among the same sources that define the processor. That would require some kind of incremental parsing and processing and I think that the NetBeans Java editor guys are not willing to bother with that.

--JaroslavTulach 05:46, 6 September 2010 (UTC)

I am using nb 6.10.m1

The project that has the annotation and processor is separate from the example project. I use it as a library in the example. I still only get the completions when writing test source code.

I am pretty sure that is not the desired behavior. I will try a nightly build.

Thanks for the pointers.

Martin Juranek said ...

Whoa, that will get handy.

About philosofical aspects: I don't think that database schema should be THE source of truth about database and entity classes. Information contained there is simply not complete, because 1) its relational 2) somtimes you need to do strange things. Considering you can describe everything in java source code (even DB specific things, thanks to annotations), its better to make java source THE source of truth. But some help when writing it and then enforcing it at compile time (annotation saying to verify whether DB schema is compatible with source) would definitely be usefull.

--Martin Juranek 09:14, 12 October 2010 (CEST)

Zolta said ...

Greetings Jaroslav! Great stuff I'll use the idea, Thanks! The update is not automatic (from 8:24 ) You mention there is an action to get the ide to run the annotation processors available. Which one is that? I can't seem to get the IDE to run the annotation processor.

--Zolta 01:51, 5 December 2010 (CET)

Zolta said ...

already answered (partly) will that be available after 6.9.1 and before 7.0 or should I use 7.0 beta if I'm eager to use this?

--Zolta 01:58, 5 December 2010 (CET)


Hello Zolta, we have not considered this functionality important enough for majority of NetBeans IDE users, so you have to use 7.0beta (at least). However the more libraries use AnnotationProcessors, the more important this kind of IDE support will be. So go on, use the LiveDB ideas and good luck! --JaroslavTulach 22:40, 5 December 2010 (UTC)

Zolta said ...

I'd like to get it work but I can't :( I added some logging to LiveDBProcessor but no clue where the problem might be. It seems it's ok since The processor runs without error. Could you help me please? see:User:Zolta/annotations

Question: what is the action you forgot to mention at 8:23 in the video? (To refresh generated Age class after change in AGE Table in DB) What were you doing there? Thanks in advance


--Zolta 13:29, 6 December 2010 (CET)

Amelia said ...

me english very bad. I think is wonderful site, good good writing. ~ hey from Poland

--Amelia 11:50, 11 May 2012 (CEST)

Bette said ...

Incredible quest there. What occurred after? Take care!

--on Immediate Programs In Home Remodeling - Psywiki Bette 00:42, 21 September 2012 (CEST)

Gretchen said ...

What's up, just wanted to say, I loved this article. It was inspiring. Keep on posting!

--Gretchen 01:04, 12 October 2012 (CEST)

Mircea said ...

This is so nice. Thanks for sharing.

--Mircea 11:39, 3 April 2013 (CEST)

Personal tools
buy