tarik el berrak

Greenhorn
+ Follow
since Oct 06, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by tarik el berrak

Hi all,

I'm using Hibernate second level cache,
I use setCacheable(true) on my criteria to tell hibernate to use the cache, but it seems that hibernate launch the query everytime even if the data doesn't change.



@Transactional(propagation=Propagation.SUPPORTS)
public Bucket getBucket(String name) {

assert name != null;

Criteria crit = getCurrentSession().createCriteria(Bucket.class);
crit.setCacheable(true);
crit.add(Restrictions.eq("bucketName", name));

Bucket bucket = (Bucket) crit.uniqueResult();
return bucket;
}








Any help
Hi all,

I'm new to hibernate and have a question :

I have a class A mapped to table TA(idA,......)
I want to manage an association (n,m) between my class A and a non persistent class B, so I create an association table called TC(idA,name,description)
which its columns correspond exactly to class B attribute (attributes of B are its key)

So, How can I annotate that to manage my association

Regards


Hi,

I have a problem and need some help.

I get a connection, i run an sql request with my satement.
the request takes abount 2 minutes and should return 180 rows. when i iterate over the resultset, the program freeze at the 20th rows without any exception.
when i debug it in my eclipse IDE, at the 20th row the iResultSet.next() couldn't be read by the debugger

Any idea???

here is my method in my dao class

===========================================================================================
public List<Record> buildRecords(String request, int idControl,
List<Column> columns) throws SQLException {

logger.log(Level.INFO, "Building records for control : "+idControl+" from request : \n"+request);
long start = System.currentTimeMillis();

List<Record> list = new ArrayList<Record>();
Statement iStmt = null;
ResultSet iResultSet = null;
long elapsed = 0;

try {

iStmt = conn.createStatement();

elapsed = System.currentTimeMillis() - start;


iResultSet = iStmt.executeQuery(request);

logger.info("Request executed in : "+elapsed+" milliseconds with ");

int i = 0;

while (iResultSet.next()) {

logger.log(Level.INFO,"ResultSet["+i+"]");
Record record = new Record(i, idControl);

Column clone = null;

try {

Object idAnomalyStr = iResultSet.getObject(Constant.ID_ANOMALY);
long idAnomaly = Long.parseLong(idAnomalyStr.toString());
record.setIdAnomaly(idAnomaly);
record.setUserlink(iResultSet.getString(Constant.USER_RLINK));

for (Iterator<Column> iColumn = columns.iterator(); iColumn.hasNext();) {

Column column = iColumn.next();
clone = column.clone();
Object value = iResultSet.getObject(column.getName());
clone.setValue(value);
record.addColumn(clone);

}


} catch (SQLException e) {
logger.log(Level.SEVERE, "Couldn't build record cause of column '"
+ clone.getName()+"' for idAnomaly : "+record.getIdAnomaly()+" for control "+idControl, e);

}

list.add(record);

i++;
}

elapsed = System.currentTimeMillis() - elapsed;

logger.info("Data got from resultSet in : "+elapsed+" milliseconds.");

} finally {

closeResultSet(iResultSet);
closeStatement(iStmt);
}

return list;

}


===========================================================================================



Hi all,

I have a problem with my jpa project.

here is the persistence file:
----------------------------------------------------------------------------
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="QuotePickerPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.quotepicker.beans.QuoteBean</class>
<class>com.quotepicker.beans.CompanyBean</class>
<class>com.quotepicker.beans.QuoteBeanId</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/trainning" />
<property name="hibernate.connection.username" value="root"/>
</properties>
</persistence-unit>
----------------------------------------------------------------------------

i get null when calling this

emf = Persistence.createEntityManagerFactory("QuotePickerPU");




any ideas ??

Thanks in advance

--------------------
Hi all,

I have a problem with my jpa project.

here is the persistence file:
----------------------------------------------------------------------------
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="QuotePickerPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.quotepicker.beans.QuoteBean</class>
<class>com.quotepicker.beans.CompanyBean</class>
<class>com.quotepicker.beans.QuoteBeanId</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/trainning" />
<property name="hibernate.connection.username" value="root"/>
</properties>
</persistence-unit>
----------------------------------------------------------------------------

i get null when calling this

emf = Persistence.createEntityManagerFactory("QuotePickerPU");




any ideas ??

Thanks in advance
Hi all,

I have some troubles using axis ant task to generate wsdl.
here is my task :
----------------------------------------------------------------------------
<taskdef name="java2wsdl"
classname="org.apache.ws.java2wsdl.Java2WSDLTask"
classpathref="manaccs.classpath" />

<target name="generate.wsdl" depends="compile"
description="generate wsdl from the service interface">

<java2wsdl className="${manaccs.services.pkg}.ServiceDelegate"
outputLocation="${manaccs.wsdl.dir}"
targetNamespace="http://${namespaceTarget}/"
schemaTargetNamespace="http://${namespaceTarget}/wsdl">
<classpath>
<pathelement path="${manaccs.classpath}" />
<pathelement path="${manaccs.build.classes.dir}" />
</classpath>
</java2wsdl>
</target>
----------------------------------------------------------------------------

when launching ant ia have this exception and the wsd file is empty.

org.apache.ws.commons.schema.XmlSchemaException: XML-22101: (Fatal Error) DOMSource node as this type not supported


Any help
15 years ago
Hi all,

What's the difference between static and dynamic sql ? which must be used and why ?

Thanks
Hi all,

a session factory is linked to a connection using the hibernate.cfg.xml. So I'm wondering why using get a session with a connection parameter ?
To create session on another persistent store different from what was configured in the configuration file ? or another goal i don't see ?

Thanks
hi all,

I want to know exactly what is an hibernate session ???

Thanks
Thank you
but, what about "Figure 6. Updates to multiple databases in same transaction" in this tutorial ?
It seems that the transaction is propagated across 2 app servers
Hi all,

I want to know How a distributed transaction works across 2 or more application servers (like Weblogic).

Thanks
hi folks,

I'm wondering where I can find the ejb3 specs as a book, because I don't like to read all the day on my computer.

Thanks in advance
Hi ranchers,

I belive there is only one instance of each servlet which the container instantiate and initilaize...
But how the container makes threads of this servlet instance ( accorind the to API, GenericServlet doesn't extends Thread class and doesn't implement Runnable interface and it's the same for its subclass HttpServlet).
Any clarifications will be welcome

Thanks in advance
I contact them via email and now I have access.
Thankx Kelvin