select *
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and n.name = 'opened cursors current'
and s.sid in (
select sid
from v$session
where machine = '[my machine]'
)
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Thursday, December 30, 2010
Oracle: what is the cursor count?
Wednesday, December 29, 2010
Oracle: Reading Table Locks And From Where
SELECT ALL
ALL_OBJECTS.OWNER,
ALL_OBJECTS.OBJECT_NAME,
ALL_OBJECTS.OBJECT_TYPE,
V$LOCKED_OBJECT.ORACLE_USERNAME,
V$LOCKED_OBJECT.OS_USER_NAME,
DECODE(V$LOCKED_OBJECT.LOCKED_MODE,
0, 'None',
1, 'Null',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share',
5, 'S/Row-X (SSX)',
6, 'Exclusive', 'Unknown') LockMode,
V$SESSION.MACHINE,
V$SESSION.PROGRAM,
V$SESSION.LOGON_TIME,
V$SESSION.TERMINAL,
V$SESSION.SID,
V$SESSION.SERIAL#
FROM
V$LOCKED_OBJECT, ALL_OBJECTS, V$SESSION
WHERE
((ALL_OBJECTS.OBJECT_ID=V$LOCKED_OBJECT.OBJECT_ID)
AND (V$LOCKED_OBJECT.SESSION_ID=V$SESSION.SID));
Wednesday, November 10, 2010
SQLite Hibernate: Primary Keys and Foreign Keys on generated values
Here a little hint on defining the correct mapping for generated values and their relationships.
If the
When I generated the database table with
Here the tip of my configuration: just make sure your generated values are "integer" by using the columnDefinition and both "create" and "validate" settings for
If the
SQLiteDialect.class is used for the Hibernate dialect and the identity column string returns "integer". When I generated the database table with
hibernate.hbm2ddl.auto=createand then read it back with hibernate.hbm2ddl.auto=validateI ended up with corrupt foreign key relationships.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [orm-layer.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Wrong column type in APPLICATION for column APPLICATION_ID. Found: integer, expected: bigint
at Caused by: org.hibernate.HibernateException: Wrong column type in APPLICATION for column APPLICATION_ID. Found: integer, expected: bigint
at org.hibernate.mapping.Table.validateColumns(Table.java:284)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1130)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:359)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at
Here the tip of my configuration: just make sure your generated values are "integer" by using the columnDefinition and both "create" and "validate" settings for
hibernate.hbm2ddl.auto.Thursday, October 21, 2010
JAXB Serializable Binding with Maven
Generating the classes from a xsd where the classes implement the java.io.Serializable interface for serialization between nodes.
The maven plugin configuration in the pom.xml
The content of the binding.xjb
The result:
. ---> pom.xml
./.settings
./src
./src/main
./src/main/binding
---> binding.xjb
./src/main/java
./src/main/java/com
./src/main/java/META-INF
./src/main/resources
---> my.xsd
The maven plugin configuration in the pom.xml
<plugins>
<plugin>
<groupid>org.jvnet.jaxb2.maven2</groupid>
<artifactid>maven-jaxb2-plugin</artifactid>
<version>0.7.4</version>
<configuration>
<extension>true</extension>
<args>
<arg>-Xfluent-api</arg>
</args>
<schemadirectory>src/main/resources</schemadirectory>
<bindingdirectory>src/main/binding</bindingdirectory>
<plugins>
<plugin>
<groupid>net.java.dev.jaxb2-commons</groupid>
<artifactid>jaxb-fluent-api</artifactid>
<version>2.1.8</version>
</plugin>
</plugins>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
The content of the binding.xjb
<jxb:bindings
version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings>
<jxb:globalBindings>
<xjc:serializable/>
</jxb:globalBindings>
</jxb:bindings>
</jxb:bindings>
The result:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "application", propOrder = {
"name",
"version",
"state",
"serverName"
})
public class Application
implements Serializable
{
@XmlElement(required = true)
protected String name;
@XmlElement(required = true)
protected String version;
@XmlElement(required = true)
protected String state;
Wednesday, October 13, 2010
Displaying MANIFEST.MF of multiple jars in directory
Oneliner for bash to dump the MANIFEST.MF information per jar.
find . -name '*.jar' -type f | while read dir; do [ -f META-INF/MANIFEST.MF ] && rm -f META-INF/MANIFEST.MF;echo $dir; md5sum $dir;jar xfv $dir META-INF/MANIFEST.MF; cat META-INF/MANIFEST.MF; doneOn MacOSX the md5sum would be md5, and if you do not have the jar util... here the unzip version.. .
find . -name '*.jar' -type f | while read dir; do [ -f META-INF/MANIFEST.MF ] && rm -f META-INF/MANIFEST.MF;echo $dir; md5 $dir;unzip $dir META-INF/MANIFEST.MF; cat META-INF/MANIFEST.MF; done
Tuesday, September 21, 2010
Thursday, August 26, 2010
Subscribe to:
Posts (Atom)
