Wednesday, September 26, 2007
Data Persisternt
sudo /etc/init.d/mysql stop
mysqladmin -u root password myPassword
mysql -u root -p
sudo /etc/init.d/mysql start
Current ID and PS
ID: root
PS: root
Unit Test, Add this to project.properties
maven.junit.fork=true
Reason:
http://forum.springframework.org/archive/index.php/t-23057.html
Finally, my Hibernate is working,
NB>the object ID value cant be set by programmer, it will specify by the application, which is hibernate or database.
Many legacy SQL data models use natural primary keys. A natural key is a key with
business meaning: an attribute or combination of attributes that is unique by virtue
of its business semantics. Examples of natural keys might be a U.S. Social Security
Number or Australian Tax File Number. Distinguishing natural keys is simple: If a
candidate key attribute has meaning outside the database context, it’s a natural
key, whether or not it’s automatically generated.
Experience has shown that natural keys almost always cause problems in the
long run. A good primary key must be unique, constant, and required (never null
or unknown). Very few entity attributes satisfy these requirements, and some that
do aren’t efficiently indexable by SQL databases. In addition, you should make
absolutely certain that a candidate key definition could never change throughout
he lifetime of the database before promoting it to a primary key. Changing the
definition of a primary key and all foreign keys that refer to it is a frustrating task.
For these reasons, we strongly recommend that new applications use synthetic
identifiers (also called surrogate keys). Surrogate keys have no business meaning—
they are unique values generated by the database or application. There are a num-
ber of well-known approaches to surrogate key generation.
from Hibernate in Action Page90 -Page91
Also, the ID should be int, short or long. Cant be String!!!!!!
Again, don't give value to ID.
I have tried some unit tests. I planned to do this by the end, but the code is too many to test, and debug, so the only wayto narrow your test and find the problem is pick up Unit Test. The Test-Record really helps.
Monday, September 17, 2007
Maven and Tomcat
Two sources about deploy to Tomcat using Maven 1.0.2, basically, it follows the Ant structure: add these code to maven.xml
http://raibledesigns.com/rd/entry/running_cargo_from_maven
To deploy a web application to Tomcat, just copy the war file to /tomcat/webapps/
Once Tomcat starts up, it will automatically scan this folder, and generates a sub directory under this folder according to the .war file. You can use
tail -f /tomcat/logs/catalina.out
to check Tomcat's reaction to your deploy.
One thing is you don't have to keep on shutdown and start tomcat after your deploy. Tomcat keeps on scan webapps folder after it starts.
The other way is using Maven-Tomcat plugin, which is provided by 3rd party--codeczar.
About Java Bean:
property(in XML file) -------- setProperty(), getProperty() (Methods in Java Bean)
attributes name seems unrelated to property.
To install SVN in Eclipse:
Name: Subclipse 1.2.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.2.x
URL: http://subclipse.tigris.org/update_1.0.x
http://svn.ug.it.usyd.edu.au/svn/ebus5003_4
Thursday, September 13, 2007
Mevenide working fina!!!!!!!!!!!!!!!!y in Eclipse
Java Home point to /jre:
2. In Eclipse: Add one line below: based on your JDK version
(Window | Preferences | Java | Installed JREs |
Default VM Arguments:
JDK 1.5 or 1.6
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
JDK 1.4 -
-Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl
Refer to: http://www.xmlblaster.org/FAQ.html#xml-parser
3. Copy /MAVEN_HOME/bin to /home/ji (my home address)
in order to let Mevenide find forehead.conf
A discussion here:
http://jira.codehaus.org/browse/MEVENIDE-231
After several days research, finally I got Mevenide run in my Eclipse, and understand that Mevenide 0.4.0 is a bugful plugin. Although I can run Maven in Eclipse, I wouldn't do this now. Also Mevenide 0.4.0 seems the lastest version of Mevenide supported Eclipse. It shifts to other IDEs. PS. this bug seem commonly exists under Linux platform, Maven 1.0.2 and Eclipse 3.1+
Wednesday, September 12, 2007
Ubuntu with BEA Workshop Studio 10.1
http://workshopstudio.bea.com/install/install.html#nxtrialactivation
Address to download BEA Workshop Studio 10.1
http://workshopstudio.bea.com/downloadNitroX.do
The free license BEA Workshop™ for WebLogic 10.1 only supports BEA WebLogic Server, which is the main different from Workshop Studio ()
"BEA Workshop Studio has all the same
features as BEA Workshop for WebLogic, but adds
the capability to develop, debug, deploy to BEA and
non-BEA server targets like Apache Tomcat, IBM
Websphere, Caucho Resin, Mortbay Jetty and
Redhat JBoss (in addition to BEA WebLogic Server)."
After you download the Workshop.bin, just double click the icon. It just works without any configuration.
Register with email, and wait 5 minutes to get the reply, then try the trial version for 30 days
Simply speaking, BEA Workshop is Eclipse with many plugins, but I still have to install SVN and Mevenide, again, Mevenide doesn't work, but with another error this time
I download my project uploaded by Eclipse 3.3, and it works well in Eclipse 3.2 which supplied by Workshop.
Tuesday, September 11, 2007
Subclipse stays on one Workspace
cp -r .metadata/ /home/ji/projects/
or you can try remove the .metadata under your current workspace
rm -r .metadata/
Saturday, September 08, 2007
Add plugin for Maven in Ubuntu
####To start a root terminal:
gksudo gnome-terminal
export MAVEN_HOME=/opt/maven
export MAVEN_REPO=/home/ji/.maven/repository
export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m'
export PATH=$PATH:$MAVEN_HOME/bin
maven plugin:download -DgroupId=maven-plugins -DartifactId=maven-axis-plugin -Dversion=0.7
####This creates a new Maven repository under /root, I don't know how to change it back to my normal user repository.
This is the server I use to download plugin:
http://mirrors.ibiblio.org/pub/mirrors/maven/maven-plugins/plugins/
Don't try to put a plugin straight to Maven plugin folder, it crashes Maven.
My Eclipse still doesn't work in using Maven plugin~~~!!! Is it possible my Maven too old for Eclipse 3.3.
Why don't we use higher version of Sakai, so that it can support Maven 2?
The answer to this is, till now the lastest version of Sakai only supports Maven 1.0.2 well.
Friday, September 07, 2007
Thursday, September 06, 2007
Using Maven
Setup Maven 1.0.2
Add these lines below in a file called project.properties, so that your can run the genapp under a folder with this file in.
maven.xdoc.date = left
## maven.xdoc.version = ${pom.currentVersion}
custom.zipsource = true
maven.repo.remote=http://mirrors.ibiblio.org/pub/mirrors/maven/,http://source.sakaiproject.org/maven/
Refer to Massol
maven -g grep genapp
##Credit to San
Now I start to worry if the network doesn't work, what things can I do with Maven.
Ubuntu
To do copy and paste from window to window as root permission, run this:
sudo nautilus
##Credit to Hank
Maven POM description
http://maven.apache.org/maven-1.x/reference/maven-model/3.0.2/maven.html