mySQL延迟
在主外键表存在关系的时候如果加上"lazy=true"的话,则表明延迟,即只查询主表中的内容,而不查询外键表中的内容。
例:
<hibernate-mapping>
<class name="com.pojo.Sortp" table="sortp" catalog="shjdc">
<id name="id" type="java.lang.Integer">
<column name="Id" />
<generator class="assigned" />
</id>
<property name="name" type="java.lang.String">
<column name="Name" length="40" not-null="true" />
</property>
<set name="productses" inverse="true" cascade="all" lazy="true">
<key>
<column name="Sortid" not-null="true" />
</key>
<one-to-many class="com.pojo.Products" />
</set>
</class>
</hibernate-mapping>
一般情况下就是把lazy设为true,而不是false,因为,假如设为false的话,在执行查询主表的同时,相应的子表也会查询,添加了许多无用功。
相关文档:
关于 PHP 教程的文章已经很多了,今天给大家介绍几个常用的MYSQL语句。
显示数据库或表:
show databases;//然后可以use database_name;
show tables;
更改表名:
alter table table_name rename new_t;
添加列 :
alter table table_name add column c_n column attributes;
删除列:
alter table table_name ......
我的系统是ubuntu6.06,最近新装好的mysql在进入mysql工具时,总是有错误提示:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
m ......
问:如果忘记了MySQL的root密码应当如何取回?
答:解决方法如下:
法1:在my.cnf的[mysqld]字段加入:
skip-grant-tables
然后重启你的mysqld,这样久没有密码了.
然后进入mysql。
UPDATE mysql.user SET Password=PASSWORD
('password') WHERE User='root';
成功后
FLUSH PRIVILEGES;
最后去掉my.cnf中的s ......
以下是完整的例子。
1、新建表
#title: 自定义字符
#auther: 小强(占卜师)
#date:
2008
-
01
-08
drop
table
if
exists
Category;
create
table
Category
(
cateId &nbs ......
新安装后的mysql数据库,其默认的最大连接数为100。
方法一:
在mysql安装路径下,找到my.ini或者my.cnf文件,打开它找到max_connections,设置成1000; 然后重启mysql服务。
方法二:
在mysql运行环境下,进入mysql命令下:
mysql> set global max_connections=1000;
然后关闭mysql重启它;
在./bin路径下,使用 # ......