InvocationTargetException when running a javafx program

Your MainController doesn’t have a zero-argument constructor. If the FXMLLoader encounters a fx:controller attribute on the root element, it attempts to create an instance of that controller by (effectively) calling the zero-argument constructor of the class specified in the attribute. To fix this (the simplest way), remove the fx:controller attribute from the FXML file, and … Read more

How do I draw a triangle?

You may use Graphics.drawPolygon(int[], int[], int) where the first int[] is the set of x values, the second int[] is the set of y values, and the int is the length of the array. (In a triangle’s case, the int is going to be 3) Example: Output:

How to fix the Hibernate “object references an unsaved transient instance – save the transient instance before flushing” error

You should include cascade=”all” (if using xml) or cascade=CascadeType.ALL (if using annotations) on your collection mapping. This happens because you have a collection in your entity, and that collection has one or more items which are not present in the database. By specifying the above options you tell hibernate to save them to the database when saving their parent.

“Could not find Java SE Runtime Environment.” after installing Java

Finally found a forum post that outlined what the registry is supposed to look like when not broken. Added key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment Added String Value CurrentVersion = 1.7 Added key HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7 Added String Value JavaHome = C:\Program Files\Java\jre7 Running cmd java -version and Eclipse now works

What are the possible values of the Hibernate hbm2ddl.auto configuration and what do they do

From the community documentation: hibernate.hbm2ddl.auto Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly. e.g. validate | update | create | create-drop So the list of possible options are, validate: validate the schema, makes no changes to … Read more

Collections.emptyMap() vs new HashMap()

From Effective Java, Item #43 – “Return empty arrays or collections, not null” demonstrates returning an empty collection and perhaps even demonstrates using these emptyList(), emptySet(), and emptyMap() methods on the Collections class to get an empty collection that also has the additional benefit of being immutable. From Item #15 “Minimize Mutability”. From Collections-emptySet-Collections-emptyList-Collections Its a type of programming idiom. This is for people that do not … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)